Go Back   iTrader Forums » iTrader Chat » General Chit Chat » HTML/XHTML Design

HTML/XHTML Design Discuss anything to do with HTML XHTML design here.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 20th March 2008, 08:44 AM
Junior Member
 
Join Date: Mar 2008
Posts: 1
Credits: 0
Default How do I control this in HTML forms?

Okay, I'm making a form for an HTML class. It is an online class that I am taking. I have to validate my form. I think I got almost everything I need. But, one aspect is giving me trouble. How do I control what people enter in the fields? For example, how do I get people to only enter numerals in a zip code field instead of letters? Also, how do I make sure people enter an actual email address instead of just random characters? Thanks.
Reply With Quote
  #2 (permalink)  
Old 20th March 2008, 01:16 PM
Junior Member
 
Join Date: Mar 2008
Posts: 1
Credits: 0
Default

This is beyond HTML, you will probably need to use some javascript with this. I'm just learning it right now so I can't share much in terms of actual coding, but the following would be good philosophical rules to check against.A workable zip code is composed of five numeral digits, 0-9. If the inputted text is longer than 5 characters or contains any alphabet or special characters, you can reject the entry.Every e-mail address is of the form x@y.z . You can check to make sure the inputted text contains an @ character, and even add the condition to check for a period somewhere after the @.You can run a check immediately after text is entered into a form by using an onChange event handler in your HTML code:In this case, the function checkZip would execute after the zip input is changed by the user. In writing this function, you could easily implement the rules I listed above to either accept or reject the entry.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 02:05 PM. Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
Ad Management by RedTyger


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72