The name can’t be empty and password can’t be less than 6 characters long. The user will not be forwarded to the next page until given values are correct.
For example, when the date is checked, the return value, , is an array with elements 1 through 3 containing the day, month and year components of the input string.If you're setting up a calendar of future events you would check that the year is the current year or greater.The code behind the form now is as follows: If you're not already familiar with regular expressions, then this might be getting a bit complicated.The time field will allow input starting with 'hh:mm' following by an optional 'am' or 'pm'. The code behind the form is as follows: For each field in the form (first the dates, then the time field), a check is made as to whether the input is blank.If not, the input is compared to the regular expression.
In this case, we've created a stand-alone functions which will validate a date field: In each case the value passed to the function is the form field rather than the field value.