Question
· Feb 6, 2020

JS Script doesn't work in CSP page

Hi, I try to do a JS script into a csp page for a Workflow

The problem is that in Ensemble i don't had troubles but in Iris don't recognize even the console.log inside the script

I attach the code

   <form>
<table class="workflowtable">
<CSP:IF CONDITION='%task.%FormValues.IsDefined("montoDeposito")'>
<tr>
<td>
Monto Depositado:
</td>
</tr>
<tr>
<td>
<input type="text" 
name="montoDeposito"
value="#(%task.%FormValues.GetAt("montoDeposito"))#">
</td>
</tr>
</CSP:IF>
<CSP:IF CONDITION='%task.%FormValues.IsDefined("numFolio")'>
<tr>
<td>
Numero de Folio:
</td>
</tr>
<tr>
<td>
<input  type="text"
name="numFolio"
id="numFolio"
minlength="3" maxlength="6"
onload="document.getElementsByName('BTN_Validar Deposito')[0].disabled = true;"
onclick="if( this.value==''){
document.getElementsByName('BTN_Validar Deposito')[0].disabled = true;
return false;
}else {
document.getElementsByName('BTN_Validar Deposito')[0].disabled = false
};"
onchange="if(this.value.length < 3 || this.value.length >6 || this.value==''){
alert('Numero Folio debe tener entre 3 a 6 digitos');
this.value = '';
document.getElementsByName('BTN_Validar Deposito')[0].disabled = true;
return false;
}else {
document.getElementsByName('BTN_Validar Deposito')[0].disabled = false
};"
value="#(%task.%FormValues.GetAt("numFolio"))#"> </input> </td>
</tr>
</CSP:IF>
</table>
</form> <script language="JavaScript">
console.log('Entro al script')
function onLoad(form)
{
alert("Se ejecuto el onLoad");
console.log('onLoad');
    return true;
}
function validaTest()
{
alert("Se ejecuto el validaTest");
}
</script>

Discussion (2)2
Log in or sign up to continue

Hola Hector, 

Maybe another javascript error is causing the problem and that's why you are not reaching to the console.log line. 

In order to find the problem I would keep simplifying the page, remove code from above, down, etc... until it works. Being a CSP page is not affecting, as the output seen by the browser would be html. 

Another tip would be ti open the console window and checking for other errors. Also look at the code from the browser, not the one from the server. That will give you where the problem is. 

If you keep getting problem, even after simplifying the page, please paste it here so I can have a look and try to reproduce it locally. Of course if this becomes something urgent, you should open a WRC problem with support.