Populate date field with current date when checkbox selected
Hi,
I have a checkbox with a related date field in a form and want to populate the date field with the current date only when the checkbox is selected. The checkbox uses a static LOV of Yes,No values.
I have this in the HTML Form Element Attributes of the Checkbox item:
onChange="javascript:addthis();"
I have this in the HTML Header for the page:
function addthis(){
var val1 = ($v('P21_CHECKBOX'));
if ($v('P21_CHECKBOX') = "Yes"){
var answer = to_date(sysdate)
$s('P21_DATE',answer);
}
}
It is not populating the date. Any suggestions are greatly appreciated.
Thanks,
Matt