Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Alphabets only valitation

 
prem ranjith
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hellow friends

How to validate the text field, alphabets only.. any one can help me.

With Regards
premranjith
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Validate against a regular expression.
 
prem ranjith
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
have any example.. becase i am new one

 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know what version of Struts you're using.
 
prem ranjith
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
strts1.2
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://struts.apache.org/1.2.9/userGuide/dev_validator.html

See the "mask" validator.
 
Richard Golebiowski
Ranch Hand
Posts: 213
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Design wise, wouldn't it be better to filter the user input so that only alphabetical characters are allowed?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, although that can be done as well. Client-side validation is not a replacement for server-side validation--it is a usability enhancement.
 
Richard Golebiowski
Ranch Hand
Posts: 213
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not validation, filtering. Let's take the case of a phone number into a text field. Wouldn't the best practice be to only allow numbers to be input into that field? What's the point of doing it server side and kicking it out when the user could have been saved the hassle on the client side of having to redo it? Server side validation is still good to do to as a precaution, but as good design shouldn't the first step be to prevent invalid input?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Richard Golebiowski wrote:Not validation, filtering. Let's take the case of a phone number into a text field. Wouldn't the best practice be to only allow numbers to be input into that field? What's the point of doing it server side and kicking it out when the user could have been saved the hassle on the client side of having to redo it? Server side validation is still good to do to as a precaution, but as good design shouldn't the first step be to prevent invalid input?

As I said, client-side [whatever you want to call it] is fine, but ultimately is nothing but user experience enhancement. Input filtering a subset of validation.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic