J 2.5.7 F 3.0.6
I need to validate a date using Javascript. If it is a good date, I return true, else return false. Here is the basic code :
In the "date" element (a text field). I have the following coding in Javascript:
I then have a 1.js file as (my form id =1):
That all works fine. (I can see that in Firebug) What I can't figure out is if the date fails and returns false, how to clear the input field and set focus to the field.I still haven't figured out the relationship between Fabrik and plain ole Javascript. I know this should be simple, but.....
Thanks for any help.
I need to validate a date using Javascript. If it is a good date, I return true, else return false. Here is the basic code :
In the "date" element (a text field). I have the following coding in Javascript:
Code:
var dateStr = form_1.formElements.get('datetest___date1').getValue();
date_check3(dateStr);
Code:
function date_check3(input) {
// Checks for the following valid date formats:
// MM/DD/YYYY
// Also separates date into month, day, and year variables
var dateStr = input;
.
.
Validation code
alert("Month must be between 1 and 12");
OK = false;
.
.
if (OK) return true;
else return false;
}
Thanks for any help.