Why can't I get the Value of my True/False field

Stacy1
Mega Guru

I have a true/false field.  I need to see the value so I can do an If script when it is true.

If I do:  var ip = g_form.getValue('u_ip'); 

The alert is blank.

If I do  var ip = g_form.getBoolenValue('u_ip');

The alert returns false regardless of it being true or false.

I can't do display value because that gives me the Case Number.

Any magic I am missing.  

Thanks,

Stacy

1 ACCEPTED SOLUTION

Hi, syntax looks ok and it works correctly for me if I paste to my instance (after updating the reference field).
Is you field visible on your form?
Is the script 'Active' ?
Is script in correct scope?
If are you domain seperated, is domain correct?
Do you have the correct table selected for the script?

View solution in original post

9 REPLIES 9

Hi, syntax looks ok and it works correctly for me if I paste to my instance (after updating the reference field).
Is you field visible on your form?
Is the script 'Active' ?
Is script in correct scope?
If are you domain seperated, is domain correct?
Do you have the correct table selected for the script?

Hmm good thought cross scope issue.  Let me play with that.

Still not working.

So I deleted the true/false field and turned it in to a string field with choices of true or false.

And it still does not work.

The table is in the sn_customerservice_case scope where I added the field to the table and so is the client script.

My alert returns an empty alert.

function onLoad() {
     var ip = g_form.getValue('u_ip');
 alert(ip);
    if (ip == true) {
        alert("Hello World");
    }

}

??Dazed and Confused??

Stacy

Very odd indeed, as the code is simple enough, Do you see any errors in browser console

You could add debug message to the first line, just to confirm the script is actually (not) running.
g_form.addInfoMessage("is this running');

You will need to make your 'true' condition 'text', but you should still get the first alert regardless.

if (ip == 'true') {

 

You are right the problem is because the field is not on the form.

Thanks,

Stacy