I have an application with RichFaces 3.3.3 in which I am passing a number and editing it in a modal dialog. Inside the dialog, I am using a rich:inputNumberSpinner component to display the value and allow the user to edit it, an OK and a Cancel button. I have a minimum and a maximum limit to the user-input value. When the user enters something outside this range (manual Input is enabled for the spinner), the spinner component auto-corrects it to the max (if more) or the min (if less). The auto-correction visibly happens "onblur" of the spinner component. However, I would like to display an error message to the user when this happens (and not submit the form and the auto-corrected value). The problem is that despite my efforts, I cannot seem to hook up to the auto-correction of the spinner. Below is my code and a description of what I have attempted:
<ui:composition xmlns="http://www.w3.org/1999/xhtml" .....>
<rich:inputNumberSpinner id="numberValue" style="width: 290px;"
I have tried the following approaches:
The first one is the "onError" attribute of the spinner. According to these threads (in one of them I also wrote about my troubles): https://community.jboss.org/message/46883#46883, https://community.jboss.org/message/31284, I could catch the "onError" event when the user enters a value outside the range. The problem here is that the "onError" event is not raised before the form is submitted (or anytime after that to my knowledge either).
The second thing I have attempted is to hook up to every onKeyPress event & each time compare the input with the min & max limits. I am using the "oninputkeyup" for this purpose, because it is the first event that is executed after the user input. The "oninputkeypress" is fired before the field value is set to the Backing Bean property.
The problem with the "oninputkeyup", however, is that it is not fired in case the value of the spinner is outside the min-max range!
Another thing I tried is the "onblur" event. It, however, is fired after the spinner has auto-corrected the value.
I would highly appreciate any advice or direction that you could give me in this situation.
Thank you in advance!