I am trying to create a web page containing a from, this form should contain the following input fields: full name (a text field) and date of birth (another text field, with input required in the form DD/MM/YYYY.
Each text field should have suitable labels to identify what is required to be input within them. The contents of each text field should check on a blur event to ensure they are not empty. Once both text fields have suitable contents they should perform checks on contents as follows:
1)the full name text field contents should start with a letter, contain at least one space, and end with a letter
2)the first and second characters of the date of birth text field should be digits, as the forth and fifth characters, and seventh, eight, ninth and tenths characters.
If the contents of a field, or both fields, does not match the requirements above the user should be able to clear both contents of both and display a suitable error message in a alert box.
If the contents are validated, the form should display an alert box with the following message: “Hellow <initial(s)><Surname>. Did you know that your next birthday you will be <age> years old?”.
Example if the user inputs “Tony Charles Lynton Blair” in the name field and “06/05/1953” in the field date the resulting output should be (if the current date is the 17/01/2004:
[B]Hello T.C.L. Blair. Did you know that on your next birthday you will be 52 years old?
I dont know if any body can help as I’m new to Javascript and end up in knots trying to work out how to do this script.