473,386 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

form validation best practice

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.

Jul 23 '05 #1
3 1318

Depends on the scenario, js can do data checks just fine, so, it really
depends, but onsubmit is a popular way to use. Server sided submits for
checking, and loads the result either if it validates or not, is uses the
client bandwidth regardless to do a page request and page serving, there's
timing and server load, while using it client sided, there isn't any
delays due to session transactions, if the user makes a mistake, it's let
known right away and addressed right there. You could do a browser check
server sided in order to spot older browsers and do server sided for them,
else, use js.

Danny

On Sun, 19 Jun 2005 15:18:08 -0700, <te***@yahoo.com> wrote:
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.


--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Jul 23 '05 #2
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

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #3
Danny wrote:
<snip>
... . 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.]
On Sun, 19 Jun 2005 15:18:08 -0700, <te***@yahoo.com> wrote:

<snip>

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

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

Richard.
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Stefan Richter | last post by:
Hi, after coding for days on stupid form validations - Like: strings (min / max length), numbers(min / max value), money(min / max value), postcodes(min / max value), telefon numbers, email...
12
by: cruiserweight | last post by:
I've constructed this form so that if Javascript is disaabled it will show a typical <input type="submit"> button, BUT using the <noscript> tag. Why is this a problem and what's a viable solution?...
4
by: Sandy | last post by:
Hello - If I use a validation summary control and set the ShowMessageBox to true, will the messagebox that comes up be blocked by pop-up blockers? Does the messagebox work in all browsers or...
9
by: julie.siebel | last post by:
Hello all! As embarrassing as it is to admit this, I've been designing db driven websites using javascript and vbscript for about 6-7 years now, and I am *horrible* at form validation. To be...
3
by: redefined.horizons | last post by:
I'm new to C#, (coming from a Java programming background), and I have a question about the correct use of exceptions. My book "Programming C#" by O'Reilly says the following in Chapter 11,...
2
by: jamesd | last post by:
I have a user control that has some simple textboxes. The user control is placed into a regular webform with a submit button on it. When the submit button is clicked, the form is posted to the...
27
by: Chris | last post by:
Hi, I have a form for uploading documents and inserting the data into a mysql db. I would like to validate the form. I have tried a couple of Javascript form validation functions, but it...
10
by: gweasel | last post by:
What is the best way to apply a Validation Rule - or rather, where is the best place to put it? Is there an advantage to putting it on the field in the table vs setting the validation rule on the...
12
by: Gustaf | last post by:
I've been working on a membership form for a while, and find it very tedious to get an acceptable level of form validation. A web search for solutions revealed some home-brewed solutions, such as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.