1 Reply Latest reply on Feb 18, 2011 2:30 AM by Mark Paluch

    How to avoid h:commandbutton action

    Eswara MoorthyNEC Newbie


             The following page open in new window.

             This apge have one text box and two button(h:commandbutton and a4j:commandButton).


      I move(set) the cursor focus into textfield.

      My problem is, i hit enter button from textfield, then automattically called h:comandButton action and closed new window. How to avoid this.


      But, I need , when i hit enter button, move the cursor focus to <a4j:commandButton>



                  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
                  <script type="text/javascript">
                      function a4jButtonClick()
                          alert("A4J Command Buton clicked...");
                  <h:form id="sampleForm">
                      <rich:panel id="samplePanel">
                       <h:outputText value="User Name : "/>
                       <h:commandButton value="Closing CommandButton" 
                                        onclick="javascript:window.close(); />
                       <a4j:commandButton value="A4JCommandButton" onclick="a4jButtonClick()"/>                      

      If i hit enter button from textfiled, i want to call the script  alert("A4J Command Buton clicked...");


      Help me.

      Thank in advance.