I have a check box and a date field on the form. The requirement is to display the System Date in the date field when the check box is checked by the user and to clear the date field when the check box is unchecked by the user. Although the user has unchecked the check box and saved the form it displays the previously saved date by the user. I used the following code to save it.
Following code will solve the problem and will set it to Empty when it saved.
//if Reviewed by Manager chekbox is checked
if (ReviewedManager == true)
//set the Date Reviewed by to system date
crmForm.all.cpms_datereviewedbymanager.Disabled = false;
crmForm.all.cpms_datereviewedbymanager.DataValue = new Date();
crmForm.all.cpms_datereviewedbymanager.DataValue = null;
crmForm.all.cpms_datereviewedbymanager.ForceSubmit = true;
crmForm.all.cpms_datereviewedbymanager.Disabled = true;