This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

rich:ajaxValidator problem

 
Tudor Raneti
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic