Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
function date_format(value) {
//Accepts 1 or 2 digit day/month fields and 2 or 4 digit year fields. Accpets - . and / as date separators.
// var re = /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/; //four digit years only.
var re = /^\d{1,2}(\-|\/|\.)\d{1,2}\1(\d{2}|\d{4})$/; //Accepts 2 or 4 digit years.
return re.test(value);
}
if (sResult=[red]=[/red]"false") {
alert("Date not in valid format.")}
else {
alert("Date format accepted.")}
function date_format(oneinput)
{
var value=oneinput.value;
/*
rest of your code here
*/
if (sResult=="false")
{
alert("Date not in valid format.")
oneinput.value='';
}
else
{
alert("Date format accepted.")
}
}
<input type="text" name="date" onchange="date_format(this)">