This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSF and the fly likes rich:ajaxValidator problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "rich:ajaxValidator problem" Watch "rich:ajaxValidator problem" New topic
Author

rich:ajaxValidator problem

Tudor Raneti
Ranch Hand

Joined: Nov 29, 2009
Posts: 145
I'm using JSF 1.2 on JBoss 5.1GA.
My problem is that if i use event="onblur", the second time in a row the component loses focus i receive this validator(or convertor?) message instead of mine:

j_id_jsp_747421929_4:sold_quantity: '8,8' must be a signed decimal number consisting of zero or more digits, that may be followed by a decimal point and fraction. Example: 198.23


This is my validation annotation:


this is in my .jsp file:


Using event="onkeyup" or event="onblur" doesn't remove the validator message when the input is fine, and if i insist eventually i get the other message above.

EDIT:

Playing some more with it, made this test, that has a similar problem:



While it displays the message, it only happends when the control loses the focus twice, same for message removal, it doesn't remove it the first time the valid control loses focus, but the second time.

EDIT2:
there are a couple of ways to avoid this:
First, create your own JSF regex validator and use a4j:support for AJAX behaviour.
Second, use a String instead of the data type that triggers the JSF validator/converter (like my BigDecimal), then do the parsing in the backing bean before using it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: rich:ajaxValidator problem
 
Similar Threads
Ajax behavior/ Conditional rendering
rich:comboBox fails to reRender due to rich:ajaxValidator
How to show a single error message for all fields
ArrayIndexOutOfBoundsException on h:inputText validation
comboBox onblur event not called