Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

form validator to check for alphabets in a text field

 
Vidya Moorthy
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64852
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 .
 
Vidya Moorthy
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new around here and hence didn't know that. Thanks for letting me know.
Vidya
 
Tom Katz
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
onBlur should work (in place of onClick), in order to capture when the user leaves that field.
 
Tom Katz
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To clarify, the onBlur could be on the input/text, not in place of the onClick for the button.
 
Tom Katz
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic