-
1. How to disable the enter key for a particular component
mp911de Jan 31, 2011 5:37 AM (in response to ashwaja)There are two ways to register <rich:hotKey>:
- place it anywhere on the page. In this case the <rich:hotKey> component is attached to the whole page (
html[0] element
). This is default scenario. - attach it with "selector" attribute to all the elements defined using this selector. This attribute uses defined by w3c consortium syntax for CSS rule selector with some jQuery extensions.
Just define a Selector for the Components you want the hotKey attach to.
- place it anywhere on the page. In this case the <rich:hotKey> component is attached to the whole page (
-
2. How to disable the enter key for a particular component
ashwaja Jan 31, 2011 6:13 AM (in response to mp911de)Hi,
Thanks Mark for providing your ideas but, we have solved it using a javascript function.
This JS function will check for the keycode of enter key when the key is pressed for any specific field.
Thus we will not handle the event when the enter key is pressed.
Thanks,
Harish.
-
3. Re: How to disable the enter key for a particular component
erickson Jun 29, 2011 2:04 PM (in response to ashwaja)I'm having the same problem, Harish. Can you paste the code that solved it?
Thanks.
-
4. Re: How to disable the enter key for a particular component
ashwaja Jun 30, 2011 2:46 AM (in response to erickson)This below code had solved my issue.
function handleEnter(field, event) {
var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
if (keyCode == 13) {
return false;
}
else{
return true;
}
} -
5. Re: How to disable the enter key for a particular component
erickson Jun 30, 2011 10:15 AM (in response to ashwaja)thanks, I solved the problem using the rich: HotKey with selector property like Mark Paluch said.