Reply
Form Validating
Old 05-16-2007, 02:22 PM Form Validating
eslaime's Avatar
Junior Talker

Posts: 1
Name: ozlem karsli
Hi all,

I have a form made with text boxes. I need to create two simple javascript functions which is not containing the text box name or id, but checks the text box when something is typed in the text box. No matter from which text box name or id it is called, this functions must work. Because I need to use these functions for multiple text boxes.

1- First function restricts the user typing the keys which are not 0-9
2- Second function restricts the user typing the keys which are not a-z/A-Z

For example:

When someone types 0-9 or any other characters to my first field which uses a-z/A-Z only function, gives an alert of "Please use only letters".

When someone types a-z/A-Z or any other characters to my second field which uses 0-9 only function, gives an alert of "Please use only numbers".

Please note that I am a beginner and try to explain as basic as possible. (calling the function from the code on key press etc. etc.)

Thanks very much.
eslaime is offline
Reply With Quote
View Public Profile Visit eslaime's homepage!
 
When You Register, These Ads Go Away!
Old 05-16-2007, 03:11 PM Re: Form Validating
jason_bristol's Avatar
Ultra Talker

Posts: 267
Name: Jason Eyermann
Location: england bristol
welcome to the forum eslaime.

I added something similar to this on my site. I learnt how to do that from a really good form validation tutorial on this page - http://www.tizag.com/javascriptT/javascriptform.php

I don't know if you can use javascript to tell the user they are inputting the wrong characters as soon as they type it though.
jason_bristol is offline
Reply With Quote
View Public Profile Visit jason_bristol's homepage!
 
Old 05-21-2007, 07:35 AM Re: Form Validating
jito's Avatar
MY LIFE IS 'i' LIFE

Posts: 565
Name: surajit ray
Location: inside the heart of my friends
try the onKeyDown method with text box and for validation use regex.
__________________
I am not smart, that's why i don't act smart
jito is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Form Validating
 

Thread Tools

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 Off
Pingbacks are Off
Refbacks are Off


Webmaster Resources Marketplace:
Software Development Company | Webhosting.UK.com | Text Link Brokers 


   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11356 seconds with 12 queries