this tutorial has a quite complicated/lengthy solution, which involves recompiling source code: How to disable form submit on Enter and fix for RichFaces rich:inputNumberSpinner
my solution is way simpler:
open richfaces-ui-3.3.3.Final.jar in an archive manager
then open this file in a text editor (double click the file):
/org/richfaces/ui.pack.js
beginning around line 15151, you'll see the following lines:
}if(A.keyCode==13){if(this.spinner.required||""!=this.edit.value){this.edit.value=this.getValidValue(this.edit.value)
}if(this.edit.form){this.edit.form.submit()
change the second line so it looks like this:
}if(this.edit.form){/*COMMENTED OUT BY ME: this.edit.form.submit()*/
when you save the file ui.pack.js in the text editor, the archive manager should ask you if you want to update the jar file, choose Update
clear your browser cache, stop your app server, rebuild your project, then restart your server, then test it out in the browser and you should now be able to hit the enter key in a rich:inputNumberSpinner without submitting the form :)
see also: How to stop page refresh when hit enter button from rich:inputNumberSpinner field?
and here's the bug registered in the jboss issue tracker:
inputNumberSpinner: autosubmit of a form while pressing the ENTER KEY, validation is discarded and modal panel is closed
IT, computer and programming tutorials and tips that i couldnt find anywhere else using google, from my daily work as a Senior Developer of solutions using Java and Linux.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment