4 Replies Latest reply on Feb 12, 2012 8:18 AM by vi_mahe_ka1

    Submitting on enter at rich:popupPanel

    nadushka

      Hi everybody.

      I use richfaces 4.0.0.final

      I have the following problem :

      I have a simple popup panel with one input text and a an a4j:commandbutton . Hitting 'enter' while focus is in  the input field does not execute action of the commandButton.

      If I test this on a normal page, without a rich:popupPanel it works.

      The code looks like this:

       

      <h:form id="searchPopupForm" rendered="#{searchPopupVisible}">
              <rich:popupPanel id="searchPopup"
                               domElementAttachment="form"
                               show="#{searchPopupVisible}"
                               modal="true"
                               autosized="false"
                               resizeable="true"
                               rendered="#{searchPopupVisible}">
      
                  <f:facet name="header">
                      <h2><h:outputText value="#{title}"/></h2>
                  </f:facet>
      
                  <f:facet name="controls">
                      <a4j:commandButton
                              value=" "
                              execute="none"
                              immediate="true"
                              render="searchPopupPanel"
                              title="Close"
                              action="hideCustomerPopup"/>
                  </f:facet>
      
          <a4j:outputPanel id="searchFilterPanel" rendered="#{model.searchRendered}">
              <h:inputText id="searchInput"
                           value="#{searchValue}"/>
              <a4j:commandButton value="Search"
                                 id="searchButton"
                                 execute="@all"
                                 render="content"
                                 action="applySearch"
                                 />
          </a4j:outputPanel>
      

      I would really appreciate any help.Thank you in advance.

        • 1. Re: Submitting on enter at rich:popupPanel
          rhanus

          similar facelet works for me well

          you should have both popup and "content" in separate forms

          • 2. Re: Submitting on enter at rich:popupPanel
            nadushka

            I have separate forms for my popup and page content, nevertheless it's not working for me.

            Code for  page is like:

            <h:form id="contentForm>

                // some content  

            </h:form>

            <a4j:outputPanel id="searchPopupPanel">

                    <c:if test="#{searchPopupVisible}">

                        <ui:include src="path/searchPopup.xhtml"/>

                    </c:if>

            </a4j:outputPanel>

            • 3. Re: Submitting on enter at rich:popupPanel
              rhanus

              I would try to execute @form in popup's a4j:commandButton

              e.g. delete execute attribute of a4j:commandButton since @form is the default

               

                          <f:facet name="controls">
                              <a4j:commandButton
                                      value=" "
                                      immediate="true"
                                      render="searchPopupPanel"
                                      title="Close"
                                      action="hideCustomerPopup"/>

                          </f:facet>

              • 4. Re: Submitting on enter at rich:popupPanel
                vi_mahe_ka1

                try using this

                onkeydown='if(event.keyCode == 13) document.getElementById("searchPopupForm:searchButton").click();'

                 

                it will work.