How to validate a date field in your web form
You need your web user to enter a date in your web form. But how can you ensure that the date gets entered in a consistent and logical way?
Suppose you create a regular text field like this:
The way that different people will enter the date is likely to result in an almighty muddle e.g. "jan 3 80", "31 MARCH 1991","12/12/83" etc etc
Even worse - you may not even be able to figure it out! For example, someone from the USA may well write December 9th 2008 as 12-9-2008. But someone from the UK would enter that date as 9-12-2008!
Why drop down lists are not a great solution...
What about this?
The trouble with this is that you need three HTML fields in order to complete one item of data. That's not good at the best of times - but it becomes a nightmare if you plan to import the data into a spreadsheet or database.
Date templates - the neat and easy solution
Fortunately, with Web-form-buddy you have an easy and efficient way to validate date fields. It's quick to set up, it's simple and clear for your web users, and it guarantees you valid dates that are formatted in a 100% consistent manner.
From your Web-form-buddy control panel all you need do is select your date field and enter a date template that Web-form-buddy will use to both validate and format the data.
A Web-form-buddy date template uses the characters "dd", "mm" and "yyyy" as placeholders for the date in any combination. Here are some examples:
- mm-dd-yyyy e.g. 01-12-2008
- yyyy-mm-dd e.g. 2008-12-01
- mm-yy e.g. 03-12
- yyyy e.g. 1983
The separator does not have to be a hyphen character. So for example you could use a colon or a forward slash, or a space instead - or even have no separator. e.g.
- mm:dd:yyyy e.g. 01:12:2008
- mm/dd/yyyy e.g. 01/12/2008
- mm dd yyyy e.g. 01 12 2008
- mmddyyyy e.g. 01122008
The year can if you wish be specified as a two-digit number. So instead of "mm-dd-yyyy" you could have "mm-dd-yy".
Date templates such as these are very easy for your web user to understand. To make it even easier, Web-form-buddy will add leading zeros if they have been left off by the person completing your form. So for example, if your date template is "mm-dd-yyyy", and someone enters "1-12-2008", Web-form-buddy will automatically format that as "01-12-2008".
Adding a date field to your form
On the page that contains your web form add a regular text field. Help your web users out by showing the date template that you are using. Like this for example:
That's all there is to it! Web-form-buddy with then check that the date has been entered correctly before the form is submitted.
~ Get started with Web-form-buddy today - take the free 14 day trial! ~