3 Replies Latest reply on Sep 8, 2009 8:04 AM by John Who

    commandButton and return button

    John Who Newbie

      Hi,

      if there are more than one commandButtons on my side is there any possibility to declare some "default" by entering the return button?

      In my case I have a search button .. then there is a table with the result set and then there is an other button . If I choose some search criteria and press return the action-Method of my second commandButton gets reached.

      <rich:simpleTogglePanel switchType="ajax" width="100%">
      <rich:panel header="Suchkriterien" style="width: 99%;">
      
       <h:panelGroup >
       <table width="100%" border="0">
       <tr>
       <td><h:outputText value="number" /></td>
       <td>
       <h:inputText value="#{mb.number}" />
       </td>
       </tr>
       </table>
       </h:panelGroup>
      
       <h:panelGrid columns="1" columnClasses="alignRight" styleClass="maxWidth">
       <a4j:commandButton actionListener="#{mb.suche}" value="Search" reRender="details" ajaxSingle="true" />
       </h:panelGrid>
      
      </rich:panel>
      
      <br/>
      <rich:scrollableDataTable value="#{mb.list}" var="record" width="99%" height="250px">
       <rich:column sortBy="#{record.name}">
       <f:facet name="header"><h:outputText value="Name" escape="false"/></f:facet>
       <h:outputText value="#{record.name}" />
       </rich:column>
      </rich:scrollableDataTable>
      <h:panelGrid>
       <a4j:commandButton actionListener="#{mb.new}" value="new" reRender="details" />
      </h:panelGrid>
      </rich:simpleTogglePanel>
      
      [...]
      


      Any ideas??

        • 1. Re: commandButton and return button
          Koray Cetinbas Newbie

          Hi,

          You need to use javascript for that issue.
          Open source taglibs are also available for that.

          Take a look at the following link

          http://www.jsftutorials.net/defaultActionTag.html

          • 2. Re: commandButton and return button
            John Who Newbie

            Ok,

            if you use a a4j:commandButton (f.ex. you want to use ajaxSingle=true) the generated html-output is a .
            If you use a h:commandButton the generated output is .

            So is there any chance to use a4j:commandButton which result in a input type="submit" ??

            Because if not and you want to use f.ex a search button but there are also some aktiv detail fields they become validated by using a h:commandButton which is not(!) the expected behaviour.

            Thanks in advance.

            • 3. Re: commandButton and return button
              John Who Newbie

               

              "hrbaer" wrote:
              Ok,

              if you use a a4j:commandButton (f.ex. you want to use ajaxSingle=true) the generated html-output is a
              <input type="button">
              .
              If you use a h:commandButton the generated output is
              <input type="submit">


              So is there any chance to use a4j:commandButton which result in a input type="submit" ??

              Because if not and you want to use f.ex a search button but there are also some aktiv detail fields they become validated by using a h:commandButton which is not(!) the expected behaviour.

              Thanks in advance.