Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Required Feild

Status
Not open for further replies.

cshack

Technical User
Mar 20, 2001
52
GB
I have the following script installed on my site:

<form method="POST" action="<input type="hidden" name="Redirect" value="<input type="hidden" name="To" value="postmaster@allianceleague.co.uk">
<p><small><font face="Verdana">Your name:<br>
<input type="text" name="name" size="15">
</font></small></p><p><small><font face="Verdana">Your email address:<br>
<input type="text" name="From" size="15">
<br><br>Your message:<br>
<textarea rows="4" name="message" cols="43"></textarea>
<br><br>
<input type="submit" value="Send message">
</font></small></p>
</form>


What I need to do now is to make sure certain fields have been filled in before the form is sent.

Does anyone know of a couple of lines of script I can add to the original so that when someone doesn't fill their email address in (for example) it re-directs to another page (created by me) saying so.

Many thanks in advance
 
What you're looking for is a javascript validation routine. Go to the javascript forum and do a kekyword search on "form validation" and you'll get several pages of script examples, hints, and tips.

There's always a better way. The fun is trying to find it!
 
Of course, javascript validation is easily bypassed if users want to be malicious, so it shouldn't be used to replace a server-side system and shouldn't be considered to be a security feature.

It's very useful to aid the server-load though (i.e. get the user's own computer's processing power to decide if the fields were correctly filled in).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top