jquery: when select list value is changes, date field is required
Question
I've got a form and when the status select list is changed, the status effective date needs to be a required field.
function checkStatuses(){
$('.status').each(function (){
thisStatus = $(this).val().toLowerCase();
thisOrig_status = $(this).next('.orig_status').val().toLowerCase();
target = $(this).parents('td').nextAll('td:first').find('.datepicker');
if ( thisStatus == thisOrig_status )
{
target.val('');
}
else if( thisStatus == 'production' || thisStatus == 'production w/o appl')
{
target.val('<cfoutput>#dateformat(now(), "mm/dd/yyyy")#</cfoutput>').focus();
alert('The Status Effective Date is required.');
return false;
}
else
{
target.val('<cfoutput>#dateformat(now(), "mm/dd/yyyy")#</cfoutput>');
return false;
}
});
}
The return false is not preventing my form submitting anyway. The form above is being called by another function like such:
return checkStatuses();
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow