Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



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

Posts: 1
Name: ozlem karsli
Trades: 0
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!
 
 
Register now for full access!
Old 05-16-2007, 03:11 PM Re: Form Validating
jason_bristol's Avatar
Ultra Talker

Latest Blog Post:
New site - ConnectFrench.com
Posts: 310
Name: Jason Eyermann
Location: england bristol
Trades: 0
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.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
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
Trades: 0
try the onKeyDown method with text box and for validation use regex.
__________________
I am not smart, that's why i don't act smart


Please login or register to view this content. Registration is FREE
jito is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Form Validating
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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





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



Page generated in 0.43877 seconds with 12 queries