Hi,
I am trying to clear checkbox values (in the browser) and its not working…I have tried the following code in both OnChange and OnClick with the ‘Execute On/Change when value is changed’ checked in the properties :
doc.AreasForResReview.value = “”;
I have also tried the following :
doc.AreasForResReview.checked[0] = false;
doc.AreasForResReview.checked[1] = false;
Can anyone tell me where I am going wrong.
Thank You.
F1H
Subject: Clear Checkbox values - Web
I assume that you are trying to check/uncheck checkbox on web by clicking on either button or link, if so use this code instead -
var f = document.forms[0];
if (f.checkboxfield.checked)
{
f.checkboxfield.checked = false;
}
else
{
f.checkboxfield.checked = true;
}
This code will uncheck the checkbox if it is already checked, otherwise marks/checks it if it is unchecked.
Its better if you make a generalised function so that you can pass any checkbox element to it.
–Phani
Subject: RE: Clear Checkbox values - Web
Thanks for the reply phani,
It is actually depending on a value of another field, I do have that field refreshing the form when the value is changed (within the properties - “refresh on value change”). All i would like to do is before the refresh, uncheck the boxes.
I have tried your solution, but its not unchecking the box before the refresh, any ideas?
Thanks
F1H
Subject: RE: Clear Checkbox values - Web
I assume that “Another field” which you are referring to is “Dialog List”. Try to write the code in 'OnChange" event of the field -
Set the “Run” to “Client” and “Common JavaScript” for that field in onChange event.
var f = document.forms[0];
if (f.checkboxfield.checked) //Change the “checkboxfield” to the acutal name of the check box field.
{
f.checkboxfield.checked = false;
}
I have tested out this code in both web and client. Dont forget to change the field name “checkboxfield” to actual check box field name in your form.
–Phani