-
1. Re: inputNumberSpinner behaviour on wrong input
fabmars Nov 5, 2008 1:32 PM (in response to jiri.pejchal)Answer for this is in the FAQ:
http://www.jboss.org/file-access/default/members/jbossrichfaces/freezone/docs/devguide/en/faq/faq.html
Section 1.12 -
2. Re: inputNumberSpinner behaviour on wrong input
jiri.pejchal Nov 5, 2008 1:46 PM (in response to jiri.pejchal)Section 1.12 is How to prevent modalPanel from closing when the validation inside fails
But the problem here is that the validation inside the modal panel doesn't fail because the inputNumberSpinner sets silently the correct value with javascript. So actually my goal is to make the validation fail. -
3. Re: inputNumberSpinner behaviour on wrong input
ilya_shaikovsky Nov 6, 2008 4:09 AM (in response to jiri.pejchal)there is onerror js handler on these components. It could be used to execute custom js code if user entered wrong value.
-
4. Re: inputNumberSpinner behaviour on wrong input
gensys Apr 18, 2012 7:18 AM (in response to ilya_shaikovsky)Hello,
I cannot seem to catch the onerror event. I am also using an InputNumberSpinner inside a modal dialog.
When I input a value outside of the min-max range and change focus to another component, the value is automatically adjusted to one inside the range.
I need to catch the event, so I can let the user know what is happening. I am using RichFaces Version 3.3.3 :
<ui:composition xmlns="http://www.w3.org/1999/xhtml" .....>
<a4j:form id="numberEditorPanelForm">
<rich:modalPanel ......>
<h:panelGrid ...../>
<rich:inputNumberSpinner id="numberValue" style="width: 290px;"
value="#{BackingBean.numberValue }"
minValue="#{BackingBean.minValue }"
maxValue="#{BackingBean.maxValue }"
onerror="alert('autocorrect')>
</rich:inputNumberSpinner>
</h:panelGrid>
</rich:modalPanel>
</a4j:form>
</ui:composition>
Message was edited by: Gen Sys
-
5. Re: inputNumberSpinner behaviour on wrong input
gensys Apr 18, 2012 11:15 AM (in response to ilya_shaikovsky)Hello again,
I have been playing with the issue a little bit. I tried to catch the user-input event and compare it to the min & max values so I can provide a meaningful message to the user. However, it turns out that the "oninputkeyup" event is only fired when the input value is within the min-max range, but not when the input value is above or below.
The "oninputkeypress" is fired before the new value is applied to the backing bean component. And the"onblur" event is fired after the user-input value is already adjusted to the min or max.
Any help or direction would be highly appreciated! Thank you in advance!
-
6. Re: inputNumberSpinner behaviour on wrong input
gensys Apr 24, 2012 9:15 AM (in response to ilya_shaikovsky)Hello,
For the moment I have resorted to simply adding an info message in the dialog that notifies the user about the min & max boundaries.
This is the best possible solution that I could come up with. I am not handling any events in this situation and I leave the InputNumberSpinner do its auto-correct.
If you still have any other suggestions, they are very welcome!
Have a nice development day for now!
PS: I also put up another thread with a more thorough description of my problem, the "progress" and what I have decided to to in the end: