• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Simple contact form validation


design92

Junior Member
#1
Hi everyone,

Can any of you provide me a quote for validating my contact form as shown below please?
Contact form needs to be validated by a javascript.

Code:
First Name- 

Mandatory – make sure that an entry has been made in this field.

 

 

Second Name – 

Mandatory - – make sure that an entry has been made in this 

field.

 

House number or name – Mandatory – 

make sure that an entry has been made in this field.

 

 

Street name – Mandatory  

- – make sure that an entry has 

been made in this field.

 

 

Town – Mandatory - – 

make sure that an entry has been made in this field.

 



Post Code – Mandatory - – 

make sure that an entry has been made in this field.

 

 

Mobile – Must have an entry if Home is blank, if an entry has 

been made strip out all non-numeric characters.



Home – Must have an entry if Mobile is blank, if an entry has 

been made strip out all non-numeric characters.

 

 

Email –                                                 

Mandatory,  plus check the 

format of the email address entered – it must contain an @ symbol at some point 

after the first character followed by a dot at some point after the third 

character – the dot cannot be the last character.

 

 

 

Newspapers Read – if one of the choices is ‘Other’  

then the ‘State one other Newspaper you read’ field becomes 

mandatory.

 

 

State one other Newspaper you read –Mandatory if the ‘Other’ 

option is chosen in the Newspapers Read field.

 

 

Comments – Mandatory and must contain at least 15 

characters.

 

 

When the Submit button is clicked the JavaScript will call a function which will 

validate the entries made on the form.

A validation with errors will issue an appropriate JavaScript alert message to 

indicate fields in error. The cursor will also be focussed on the first field in 

error.

A validation with no errors will issue a JavaScript alert message to read ‘Thank 

you for your enquiry’.

 

When the Reset button is clicked all fields in the Form will be cleared of entries 

and the cursor will be focussed back to the first field at the top of the form
I have already built my contact form, so it needs just a javascript.