I am trying to disable/enable a date field based upon a checkbox and then make the date field required through validation if it is enabled. I was basing my code on the tip described in Topic 6503.
I was using:
<script>
if(document.forms.editform.value_Active.checked)
{
document.forms.editform.value_ActiveDate.disabled=false;
}
else
{
document.forms.editform.value_ActiveDate.disabled=true;
}
</SCRIPT>
<script>
document.forms.editform.value_Active.onchange=function()
{
if(document.forms.editform.value_Active.checked)
{
document.forms.editform.value_ActiveDate.disabled=false;
define('value_ActiveDate','IsRequired','Active Date: ');
}
else
{
document.forms.editform.value_ActiveDate.disabled=true;
undefine('value_ActiveDate');
}
}
function undefine(n)
{
if (document.editform != null)
{
for (i = 0; i < checkObjects.length; i++)
{
if (checkObject[i].form.name==n)
checkObjects.splice(i,1);
}
}
}
</SCRIPT>
The enable/disable function is working but I get an error on the page and the validation doesn't work. In IE the error is "Object expected". In Firefox, I don't receive an error but the validation doesn't work.
I've uploaded the project to the demo account: Project1
Go to screen Customers > Edit to see what I speak of.
Thanks.