I have a problem with InputNumber from primefaces extensions. I have an inputnumber component on my form and when I enter a value in form and right after that I press ENTER button page is submitted but without that value in inputNumber field. It only works when that field loses focus. I checked in showcase but there were the same problem. In my case, that field is required and when I press enter button, value is gone and validation message that says that value is missing is shown. Any help?
Asked
Active
Viewed 1,552 times
0
-
1Your Question is not clear – Subodh Joshi Feb 11 '13 at 07:58
-
It looks like a bug in the component. – Luiggi Mendoza Feb 11 '13 at 14:48
-
Most likely it is a bug. I fixed it in similar way that is described in answer below, but it definitely should work without it. – miroslav_mijajlovic Feb 12 '13 at 09:20
1 Answers
2
Set your input as required="true" then catch the "enter" key and change focus to an otherInput like below; Run it on your .xhtml
page between <script type="text/javascript"> </script>
tags.
$( 'form' ).bind('keypress', function(e){
if ( e.keyCode == 13 ) {
document.getElementById('Input10_input').focus();
}
});
It works also for showcase.
Good Luck!

gokhansari
- 2,379
- 1
- 27
- 33