Checking checkbox in code

I'm still fairly new to SN so this may have been answered already - but I couldn't find it.

I'd like to UN-check the "Picked-Up" checkbox on the Incident form if it's being re-assigned to someone else. I thought something like my code below would work, but it doesn't:

function onSubmit()
{
var field1 = gel('incident.u_picked_up');
if(field1.changed)
{
g_form.setValue('incident.u_picked_up', 'false');
}
}

I'm able to get the value of the checkbox fine, just not set it. As a test, I am able to set other text fields in the same manner. So what gives?


Schnikeys! That worked... thanks!


Try this...

function onSubmit()
{
var field1 = gel('incident.u_picked_up');
if(field1.changed)
{
g_form.setValue('u_picked_up', false);
}
}

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.