angus
angus

Reputation: 3320

Unexpected commandButton behavior

The problem: While the cursor is in the inputText and I press the "Enter" the dialog will popup This is happen in Chrome but not via IE:

  <h:form id="mainForm" prependId="false">   
        <h:inputText id="globalFilter" onkeypress="if(event.keyCode == 13){}"/>
        <p:commandButton id="Button1" 
                         oncomplete="widgetVar.show()"/>
        <p:dialog id="Dialog1" 
                  widgetVar="widgetVar"
                  appendToBody="true"
                  dynamic="true"/>
    </h:form>

How can I prevent it ?

Thanks

Upvotes: 0

Views: 95

Answers (1)

yudong
yudong

Reputation: 96

You can just add return false to stop this event.
Like onkeypress="if(event.keyCode == 13){return false;}"

Upvotes: 1

Related Questions