Check whether the checkbox in a form is checked or not using javascript
848623Aug 2 2011 — edited Aug 3 2011when we click a check box (TBD) it should set the value of a field to a default value '1234'. If we uncheck the checkbox, it should set the field as Null.
I have defined the checkbox as STATIC2:;1234 in form.
I used the onClick event on the checkbox and called a function to update the column.
Inside the function i am checking whether the check box is checked using
if (document.getElementById('P4_TBD').checked=true)
{
document.getElementById('P4_COL1).value='1234';
}
else
{
document.getElementById('P4_COL1).value=''; /* or $s("P4_COL1", "");
}
it works only when check box is checked. If check box is unchecked it is not setting the field as Null.
I checked document.getElementById('P4_TBD').checked=false instead of else clause. it is not working.
Please help me on this issue.
Thanks,
Ravi