GeneXus - cambiar estilo de mensajes errores en ejecucion

 
Vista:
Imágen de perfil de Osmel

cambiar estilo de mensajes errores en ejecucion

Publicado por Osmel (10 intervenciones) el 08/11/2017 22:06:20
buenas tardes colegas del foro estoy tratando de crear un javascript para poder aplicarle estilos bootstrap a los mensajes del errorview en tiempo de ejecucion

esto es un fragmento de mi errorviewer generado por genexus:

<span class="ErrorViewer gx_ev ErrorViewerBullet" id="gxErrorViewer" style="background-color: transparent;"><div class="gx-error-message">E* Debe Ingresar Código de Licencia Anticipada</div><div class="gx-error-message">E* Incorrecto Código de Situación Especial de Renuncia de Licencia Especial</div><div class="gx-error-message">E* Incorrecto Código de Situación Especial de Notificación de Licencia Especial</div><div class="gx-error-message">E* El Código de Situación Especial de Trabajo Insalubre No esta Definido</div><div class="gx-error-message">E* Debe Ingresar Código de Licencia por Licencia Especial</div><div class="gx-error-message">E* Debe Ingresar Código de Licencia por Enfermedad</div><div class="gx-error-message">E* Debe Ingresar Código de Licencia por Duelo</div><div class="gx-error-message">E* Debe Ingresar Código de Licencia por Donación de Sangre</div><div class="gx-error-message">E* Debe Ingresar Código de Horas a Compensar</div><div class="gx-error-message">E* Debe Ingresar Código de Licencia por Estudio</div><div class="gx-error-message">E* Debe Ingresar Código de Licencia por Antigüedad</div><div class="gx-error-message">E* Debe Ingresar Código de Licencia Reglamentaria</div></span>



este es mi codigo javascript colormessage.js:


function colormessage(){

$('#gxErrorViewer > div').each(function (index, value){

var text = $(this).text();

console.log(text);

if (text.indexOf("E*") != -1){
$(this).attr("class", "alert alert-danger");
} else if (text.indexOf("Los") != -1){
$(this).attr("class", "alert alert-success");
}
if (text.indexOf("M*") != -1){
$(this).attr("class", "alert alert-warning");
}
if (text.indexOf("Finalizado") != -1){
$(this).attr("class", "alert alert-success");
}
if (text.indexOf("ejec") != -1){
$(this).attr("class", "alert alert-warning");
}
if (text.indexOf("existe") != -1){
$(this).attr("class", "alert alert-danger");
}
if (text.indexOf("fuera") != -1){
$(this).attr("class", "alert alert-danger");
}
});
}

window.onload = function() {
document.querySelector('input[title="Confirmar"]').addEventListener('click', colormessage);
};

lo agregue a los ficheros estaticos de la aplicacion en genexus

y en la masterpage lo inclui:

form.JScriptSrc.Add('../static/payroll/desing/js/colormessage.js')


no cambia ningun estilo, llevo meses en esto hasta hice un user control para esto pero no me funciona del todo bien por favor necesito alguna colaboracion o alguna idea por favor Saludos
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de Osmel

cambiar estilo de mensajes errores en ejecucion

Publicado por Osmel (10 intervenciones) el 14/11/2017 22:01:37
muchas gracias por su respuesta javier probe ese UC pero no me funciono, entonces ya logre que me cambie los colores segun el contenido del mensaje del errorviewer lo que deseo desde mi javascript poder llamar por ejemplo en el evento onclick del boton confirmar llamar a mi funcion les dejo el codigo por si me pueden ayudar:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
function colormessage()
{
    $('#gxErrorViewer > div').each(function (index, value) {
       var text = $(this).text();
       console.log(text);
        if (text.indexOf("E*") != -1){
            $(this).removeClass("gx-error-message");
            $(this).addClass("alert alert-danger");
        }
        if (text.indexOf("E*") != -1){
            $(this).removeClass("gx-warning-message");
            $(this).addClass("alert alert-danger");
        }
        if (text.indexOf("Los") != -1){
             // $(this).attr("class", "alert alert-success");
             $(this).removeClass("gx-warning-message");
             $(this).addClass("alert alert-success");
        }
        if (text.indexOf("M*") != -1){
             // $(this).attr("class", "alert alert-warning");
             $(this).removeClass("gx-warning-message");
             $(this).addClass("alert alert-warning");
        }
        if (text.indexOf("Finalizado") != -1){
             // $(this).attr("class", "alert alert-success");
             $(this).removeClass("gx-warning-message");
             $(this).addClass("alert alert-success");
        }
        if (text.indexOf("Borrado") != -1){
             // $(this).attr("class", "alert alert-warning");
             $(this).removeClass("gx-warning-message");
             $(this).addClass("alert alert-success");
        }
        else {
		   if (text.indexOf("ejec") != -1){
               // $(this).attr("class", "alert alert-warning");
               $(this).removeClass("gx-warning-message");
               $(this).addClass("alert alert-warning");
            }
        }
        if (text.indexOf("previamente") != -1){
             // $(this).attr("class", "alert alert-warning");
             $(this).removeClass("gx-warning-message");
             $(this).addClass("alert alert-success");
        }
        if (text.indexOf("grabaron") != -1){
             // $(this).attr("class", "alert alert-warning");
             $(this).removeClass("gx-warning-message");
             $(this).addClass("alert alert-success");
        }
        if (text.indexOf("ingresar") != -1){
             // $(this).attr("class", "alert alert-warning");
             $(this).removeClass("gx-error-message");
             $(this).addClass("alert alert-danger");
        }
        if (text.indexOf("ERROR:") != -1){
             // $(this).attr("class", "alert alert-warning");
             $(this).removeClass("gx-error-message");
             $(this).addClass("alert alert-danger");
        }
 
        if (text.indexOf("existe") != -1){
             // $(this).attr("class", "alert alert-danger");
             $(this).removeClass("gx-error-message");
             $(this).addClass("alert alert-danger");
        }
        if (text.indexOf("fuera") != -1){
             // $(this).attr("class", "alert alert-danger");
             $(this).removeClass("gx-error-message");
             $(this).addClass("alert alert-danger");
        }
    });
 
};
 
$(document).ready(function (){
	// document.querySelector('form[method="post"]').addEventListener('mousemove', colormessage); de esta forma funciona pero despues de confirmar cuando se mueve el mouse y se desea que se ejecute la funcion colormessage cuando se confirme
	$('#gxErrorViewer > div').each(function (index, value) {
		if ($(this).text() != "") {
             //Aquí Tu Código
             document.getElementByTagName('BTN_ENTER').onclick = "if( gx.evt.jsEvent(this)) {gx.evt.execEvt('colormessage',false,'EENTER.',this);} else return false;";
		}
 
    });
 
});
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar