form validation best practice

T

tedqn

I usually use the onSubmit event to validate form because in case an
error is generated (not because user misses a field), the submit will
continue. Current I have a form in which I have to do a hidden iframe
background process to validate server side. If sucess then the iframe
page would generate the script to subit form. I don't like it because
if there's an error, the form won't be submitted at all even though
it's not the user's fault. I'd like your ideas on how to handle form
validations. Thanks.
 
M

Michael Winter

On 18/06/2005 03:24, Danny wrote:

Please don't top-post.

[snip]
You could do a browser check server sided in order to spot older
browsers and do server sided for them, else, use js.

Why bother? User submissions should always be checked on the server,
whether the client could perform the checks itself or not.

A client-side script is in a better position to determine whether it can
can perform validation. If it can't, the server will still perform the
checks anyway, so it's not a big deal, just a little more network traffic.

Mike
 
R

Richard Cornford

Danny wrote:
... . You could do a browser check server sided in
order to spot older browsers ... .
<snip>

And how do you propose doing that?

[Pays out rope with the label "User Agent header" attached to the end.]
<snip>

Please do not top-post to comp.lang.javascript, se the FAQ:-

<URL: http://www.jibbering.com/faq/ >

Richard.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top