View Full Version : form validation

code blue
05-10-2006, 01:42 AM

I'm in way over my head on a project here - i'm building a site for a regular client, who in the past have looked after all forms themselves. suddenly on this project they have just told us that we are to build an email form that needs to meet all sorts of criteria and also needs to use all sorts of javascript validation.

I've never had to do any of this before and the projects is already late!

is there anyone here who may be able to help? I have all the instructions they have supplied (it's just over my head) as well as some sample scripts.

The main instructions they have given are:

Please inform the developer that:

- the email needs to meet a specific format requirement (see attachment)
- Use JavaScript to control State/Postcode according to Country selection
- the length of “Manufacturing Date Code” should be 14
- Use JavaScript to validation data (e.g. all compulsory fields, home/work/mobile numbers, “number of faulty items within pack”) on client-site before sending the email. Note: although the attached sample code does both client-site and server-site validation, they need to review the code and implement good client-site JavaScript validation
- sample email should be sent to [email supplied]

I have created the form itsefl, i just have no idea how to apply the scripts they are asking for.

any help would be greatly appreciated

05-10-2006, 02:00 AM
You should start by explaining your client the following:
1. Using mail protocol <form action="mailto:.... for form processing is the worst way to process the form. Not only this can not guarantee the validity of data, but gives the email address to every spam bot out there. After a few weeks trying to find a form entry among all the spam will be like looking for a needle in a haystack....
2. Javascript can not validate data. It can be disabled and any information can be sent on its way.
3. Proper way to do form processing is:
- client side scripting (javascript) provides form data verification and user convinience features - sparing the round trip to the server due to a typo or missing field.
- server side script that receives the data does the actual validation, and if everything is ok, storing the data or e-mailing it. This way you can assure both accuracy of the data and privacy of the e-mail address.

code blue
05-10-2006, 02:19 AM
thanks Vladdy,

unfortunately it's not up to me, the client has a number of sites that use this method for their contact forms. Even if it was up to me, i wouldn't be able to provide any other solution as i am merely a humble html/css designer and faint at the sight of anyhting that has variables :)

I have just found that this forum has a paid section wehre i can ask someone to do the job for me for a fee, i may have to resort to that (just have to ask the boss first). Normally i'd try to work it out myself, but i really just don't have the time at the moment and my head already hurts enough!

thanks for taking the time though...

05-10-2006, 02:34 AM
I can quote the job for you if you like, as long as your client understands the consequences...

code blue
05-10-2006, 03:20 AM
thanks again Vladdy - i have just gone over it with my boss and he is going back to the client with some options at the moment.

I will certainly keep you in mind if we do need to get it done in the end.