Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

validateLongRange in JSF

 
Minni Sharma
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am new to jsf and have following problem


<h:inputText size="10" id="mailboxesId1" value="#{faces$Mailboxes.mailBoxCounter}" >
<f:validateLongRange minimum="0"></f:validateLongRange>
</h:inputText>

If a long value is not given (a non long value is given ...like a alpha numeric value) the error message shows :
"mailboxesId1": Specified value is not a valid number

can I specify the text bos name rather than id anyways ? Please help

Regards
 
Tim Holloway
Saloon Keeper
Posts: 18303
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's a "validatorMessage" attribute that you can place on the inputTextBox element to define a customized error message. The message will display exactly as coded, without that annoying ID in it.
 
Minni Sharma
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tim,
thanks a lot for your reply,but I have a constraint of using JSF 1.1 and I think "validatorMessage" is added from JSF 1.2 onwards ....is there any other way of doing the same

Regards
Minni
 
Tim Holloway
Saloon Keeper
Posts: 18303
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Minni Sharma wrote:Hi Tim,
thanks a lot for your reply,but I have a constraint of using JSF 1.1 and I think "validatorMessage" is added from JSF 1.2 onwards ....is there any other way of doing the same

Regards
Minni


It's probably easier just to switch to JSF 1.2. The differences aren't that great, other than the added improvements. Besides, JSF 1.1 is pretty old now.

About the closest workarounds I can think of are these:

1. Override the message on a global basis - but that doesn't allow you to tell people WHICH control is annoyed.

2. Write a custom validator that provides a custom message. Which is not a good long-term solution. Plus, attaching per-control messages is going to be a real pain, since custom validators don't take parameters. You'd either have to do nasty bits of internal magic or implement the validator as a full-blown custom tag.
 
Minni Sharma
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tim
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic