Jump to content

javascript validation


tauchai83

Recommended Posts

[code]
//lol, great name for this fxn.

function valiDate(input) 
{
    if(document.getElementById(input))
  {
      //gave it an id ?
    var ymd=input.value.split('-');
 
    if (ymd[0].length=='4'  && !isNan(ymd[0]))
    {
        // is a number by  !isNan?  (not (is not a number)?)
        var yeargood=true;
    }
      else { var yeargood=false; }

      // ect.  same for month, same for day.
      // return in the end,  true or false,  handle as you see fit.
    }
    // else there is no id for that input
}
[/code]
Link to comment
https://forums.phpfreaks.com/topic/35911-javascript-validation/#findComment-170889
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.