• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Validation Problem #2  RSS feed

 
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys,

One more doubt in validation, i have put two validations on my First Name field ...as follows :-


The validation that is expected is :-
The field must be mandatory
Only characters allowed
No Numbers, No Special Characters, No alpha numeric string is allowed

... however if i leave the Firstname field blank, i get the following message :-

"Only A-Z, a-z characters allowed.is required."

as pop-up window since i am using the client side validation of Struts. I want to apply only one validation at a time. Can any one PLEASE help me ? ... how can i do that ? Is there any work around in validation.xml itself ?

Million thanks in advance !
Omkar Patkar!
 
omkar patkar
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ooops ! .... I am such a fool .... i wrote the "arg" incorrectly in the validation.xml.

Now the validation .xml file looks something like this :-




But, still there is a small problem, i cannot display my custom message i have specified in the key :-

addModifyUsers.mssg.firstName.mask = Only A-Z, a-z characters allowed.


If i want to print custom message ... then what do i do ?

Thanks in advance
Omkar patkar
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The error message key used by the mask validation is "errors.invalid". You could just enter the following in your ApplicationResources.properties:

errors.invalid={0} {1}

Your second argument will be passed into the error message, so it will read: First Name Only A-Z, a-z characters allowed.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!