Click to See Complete Forum and Search --> : How do I make a form field required for submission?
wienerdog
06-02-2006, 01:36 PM
I don't have a lot of experience working with forms, and I'm desiging a basic contact information form for my company's Website. How do I make a form field required before allowing it to be sent and processed? Does this require coding in the PHP file or can I do this in the HTML?
JPnyc
06-02-2006, 02:22 PM
Javascript is generally used for form validation.
ecsyle
06-02-2006, 04:08 PM
Yeah, javascript. I would also make sure, in my form processing script, that the values are what I expect. Never trust user input. Ever.
validation done in php or asp is much better than javascript in my opinion since js can be turned off
ecsyle
06-02-2006, 04:11 PM
validation done in php or asp is much better than javascript in my opinion since js can be turned off
Use both :)
I like javascript because it gives me instant results, without reloading the page. Besides, why waste resources processing the script when you don't have to?
Use both :)
I like javascript because it gives me instant results, without reloading the page. Besides, why waste resources processing the script when you don't have to?
true, but well coded sites won't take too long to load.
JPnyc
06-02-2006, 04:29 PM
How long it takes isn't the issue. It's ineffecient to send a request to the server when it's not needed. You'll suck up your bandwidth a whole lot faster if you have an even decent number of users.
ecsyle
06-02-2006, 04:33 PM
^^^ what he said.
true, but well coded sites won't take too long to load.
Right, but if you are getting millions of hits to your site, saving resources is number one. Why incur uneeded processing time for a form, when javascript is right there for you to use?
edit: beaten.
JPnyc
06-02-2006, 04:43 PM
I never touched ya.
ecsyle
06-02-2006, 04:55 PM
I never touched ya.
But you wanted to right :o :p
JPnyc
06-02-2006, 05:04 PM
Not consciously, but........................
i guess i should put it this way. if the form field is important when submitting then i wouldn't use js.
wienerdog
06-02-2006, 05:09 PM
Alright, time to send it off to the JS coders.