![]() |
Make Fields Validate On Submit?
Hi,
I just finished creating my Contact Us Form and it all works perfectly. The only problem I have is that you can type whatever you want in the fields and it sends. Can someone please show me how I can make the fields I have * next to required and also that they are putting the right stuff in the field (ie email not in a telephone field). I use dreamweaver cs6 and heres my form code: Code:
<form id="contactformsend.php" name="form1" method="post" action="contactformsend.php"> |
You would need to use server side language such as ColdFusion, php, asp.net and the like, to safely validate form inputs. You can also use JavaScript along with a server side.
|
Could you point me in the direction of some sort of guide? It took me long enough to make the contact form and get it working I dont want to screw it up lol.
|
Start at the free tutorial, http://www.w3schools.com/js/js_intro.asp.
What you are after is form validation and it can be done on your machine (and should be). The idea is to minimize any connection to the server. There is a javascript forum here in codingforums. |
Dont use javascript alone to validate form fields. Savvy users can highjack your forms and enter whatever they want...including malicious code.
If you are using DW and you dont have a few months to learn a server side language, DW has build in form tools that add server side validation. I dont like or recommend using DW tools vs hand coding, but in a pinch they work well enough. You'll need to set up a server on your pc, whether php or coldfusion server its up to you. |
Jim? Out west? Only Teed I know.
|
Quote:
|
Quote:
Sure, there are several: https://www.google.nl/search?q=how+t...+form+with+php. I haven't tried 'em, but with their help you should be able to get the job done. As for setting up a server on your own computer, that is not necessary if you furthermore do not use php. You can test it online instead. Good luck. |
How to validate your form will depend on which server side validation you have avaliable to do the validation. Any validation you do in JavaScript is for the convenience of the person filling out the form, they can bypass it if they want to.
|
| All times are GMT +1. The time now is 12:52 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.