I have a4j command button on my jsf page , when I press Enter Key anywhere in the page this command button gets the focus and excutes its action
I want to prevent the button from getting focus when pressing Enter Key
I tried to use onfocus=”this.blur()” but it didn’t work
Thanks in advance
<a4j:commandButton>acts as a submit button. Hence executes action when pressed enter.When you see the code generated you will find like
<input type="submit"/>To ignore that you should use a command link and to look like button give a style
buttonas follows:If you still want to go with
<a4j:commandButton>then you can prevent enter by usingBut this would cause like when you press enter even
onfocusthen it would not submit or call action, better not to use it