GeeCON Prague 2014*
The moose likes HTML, CSS and JavaScript and the fly likes form validator to check for alphabets in a text field Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "form validator to check for alphabets in a text field" Watch "form validator to check for alphabets in a text field" New topic
Author

form validator to check for alphabets in a text field

Vidya Moorthy
Ranch Hand

Joined: Nov 13, 2003
Posts: 57
Hi all
I am new to javascript and trying to validate a form text field only for alphabets. If there are no alphabets, it will alert the user. I have tried to comment onclick in my program because the website is not letting me post it with that


[ December 07, 2007: Message edited by: Vidya Moorthy ]
[ December 07, 2007: Message edited by: Vidya Moorthy ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61310
    
  66

Please be sure to use UBB code tags when posting code to the forums. Unformatted code is extermely hard to read and most people will just go elsewhere. Please read this for more information.

You can go back and change your post to add code tags by clicking the .


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Vidya Moorthy
Ranch Hand

Joined: Nov 13, 2003
Posts: 57
I am new around here and hence didn't know that. Thanks for letting me know.
Vidya
Tom Katz
Ranch Hand

Joined: Aug 19, 2002
Posts: 169
onBlur should work (in place of onClick), in order to capture when the user leaves that field.
Tom Katz
Ranch Hand

Joined: Aug 19, 2002
Posts: 169
To clarify, the onBlur could be on the input/text, not in place of the onClick for the button.
Tom Katz
Ranch Hand

Joined: Aug 19, 2002
Posts: 169
Also, I *think* that if you do this:


that a true/false returned from formValidator will determine whether the form is posted, which is what you want, correct?
Vidya Moorthy
Ranch Hand

Joined: Nov 13, 2003
Posts: 57
that a true/false returned from formValidator will determine whether the form is posted, which is what you want, correct?

Yes, that is what I want. Is there any debugger for javascript? I think that the logic is right but I have made a mistake in the typing of the code. I tried installing JSEclipse plugin for the same purpose but it doesn't let me edit html files. I dont know how to do it atleast.
Thanks
Vidya
 
GeeCON Prague 2014
 
subject: form validator to check for alphabets in a text field