Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Wiki Markup
Hi,

I have a form that some fields are validate with JavaScript.  I attach the form: !Problema JavaScript - Joget.png|border=1!

The Javascript that works in V2 is: 

<script type="text/javascript">
function formbuilderCustomValidation() {
&nbsp; &nbsp;var containError = false;
&nbsp; &nbsp;var slct1 = document.getElementsByName('campoAprobacion')\[0\];
&nbsp; &nbsp;var slct2 = document.getElementsByName('campoAceptarFactura')\[0\];
&nbsp; &nbsp;var slct3 = document.getElementsByName('campoTipoAprobacion')\[0\];
&nbsp; &nbsp;var txt1 = document.getElementsByName('campoOcultoTarea')\[0\];

&nbsp; &nbsp;if(txt1.value \!= 'Radicar Factura VASA'){
&nbsp; &nbsp; &nbsp; if(slct2.value.length == ''){
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;containError = true;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;alert("Seleccione el estado de aprobación de la factura");
&nbsp; &nbsp; &nbsp; }

&nbsp; &nbsp; &nbsp; if(slct2.value == 'si'){
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if(slct1.value.length == ''){
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{ containError = true;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alert;  alert("Seleccione una opción para aprobación");
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;else{
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(slct1.value == 'si'){
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if(slct3.value == '' \|\| slct3.value == '0'){
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; containError = true;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alert;  alert("Seleccione el concepto de aprobación");
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;};  }

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}
&nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp;}
&nbsp; &nbsp;
&nbsp; &nbsp;return containError;
}
</script>

When I migrate the code into a CustomHTML, it doesn´t work. &nbsp;I apply some flags to see the behavior but I can´t see the alerts.

Somebody can help me?

Thanks\!\!\!

<script type="text/javascript">
function formbuilderCustomValidation() {
&nbsp; &nbsp;var containError = false;
&nbsp; &nbsp;var slct1 = document.getElementsByName('campoAprobacion')\[0\];
&nbsp; &nbsp;var slct2 = document.getElementsByName('campoAceptarFactura')\[0\];
&nbsp; &nbsp;var slct3 = document.getElementsByName('campoTipoAprobacion')\[0\];
&nbsp; &nbsp;var txt1 = document.getElementsByName('campoOcultoTarea')\[0\];
alert("Entro 1");
&nbsp; &nbsp;if(txt1.value \!= 'Radicar Factura VASA'){
&nbsp; &nbsp; &nbsp; if(slct2.value.length == ''){
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;containError = true;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;alert("Seleccione el estado de aprobación de la factura");
&nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; if(slct2.value == 'si'){
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if(slct1.value.length == ''){
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; containError = true;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alert("Seleccione una opción para aprobación");
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;else{
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(slct1.value == 'si'){
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if(slct3.value == '' \|\| slct3.value == '0'){
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; containError = true;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alert("Seleccione el concepto de aprobación");
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}
&nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp;}
&nbsp; &nbsp;
&nbsp; &nbsp;return containError;
}
</script>