• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Validation Problem #2

 
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic