Portal Home > Knowledgebase > Articles Database > HTML question. I have a doubt regarding email form.


HTML question. I have a doubt regarding email form.




Posted by mrcapone, 06-28-2010, 12:21 PM
Hello, How can I let my email form with mandatory fields!? I mean, all fields must be properly filled in order to submit it. I'm little frustrated with all my visitors sending incomplete form info. Thanks alot.

Posted by GraphicLoader, 06-28-2010, 12:33 PM
If it uses a PHP script to send the information you will need to edit that script to make each field as being required in the POST commands. Last edited by GraphicLoader; 06-28-2010 at 12:42 PM.

Posted by SKaero, 06-28-2010, 12:47 PM
There is solutions for this client side (JavaScript) and server side (PHP, etc.). I recommend you use both, check out http://www.w3schools.com/js/js_form_validation.asp for a simple JavaScript form validation script.

Posted by mattle, 06-28-2010, 02:57 PM
And then read this to understand why client-side validation is never enough: http://stackoverflow.com/questions/1...ide-validation

Posted by energizedit, 06-28-2010, 03:57 PM
This is easily done with javascript. How many fields are you talking about? There are numerous javascript tutorials/scripts out there for the taking.

Posted by BurakUeda, 06-28-2010, 08:12 PM
JavaScript is useful for warning messages to legitimate users. So they don't have to go to form processing page, and see the error, and browse back to the form. But as mattle said, it is not enough. I too recommend you to do both

Posted by mikk999, 07-01-2010, 12:52 PM
do both,as burakueda said, the javascript is only a warning, the php is what you really want to use to control the input.

Posted by VIPoint, 07-02-2010, 03:01 AM
Hi, Which script are you using to create the php form. You can use a basic form with mandatory field with phpform script and then customize it according to your needs.



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
Auto backup a folder? (Views: 467)
PrimeMaster Online (Views: 487)