permaculture playing cards*
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 OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP 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.
 
jQuery in Action, 2nd edition
 
subject: rich:ajaxValidator problem