Client script IF condition on a boolean variable does not work as expected


Description

In a client script, when having an IF condition on a boolean field, something like the following:

 

var bp = g_form.getValue('active');
if(bp == true){
...
}
else if(bp == false)
{
...
}

It will probably not work, since the g_form.getValue() function is returning the value as a Sting.

Resolution

Instead, you will have to write the condition as follows:

 

var bp = g_form.getValue('active');
if(bp == 'true'){
...
}
else if(bp == 'false')
{
...
}