2 Replies Latest reply on Nov 19, 2015 3:25 AM by dfilippov

    rich:popupPanel form submission issue

    dfilippov

      Hello.

      I have modal rich:popupPanel within h:form. Something like this:

      <h:form id="popupForm">
          <rich:popupPanel id="popup"
                           autosized="true"
                           domElementAttachment="form">
              <h:inputText id="templateInput" value="#{foo.template}"/>
              <a4j:commandButton id="searchButton" value="search" action="#{foo.search}"/>
              ...
          </rich:popupPanel>
      </h:form>
      
      

      When I type some text into input and press Enter to submit the form, full page reloading is invoked.

      It looks like RichFaces adds "firstHref" button tag to resulting html (for modal popups):

      <div id="popupForm:popup">
          <div class="rf-pp-shade" id="popup_shade">
              <button tabindex="-1" class="rf-pp-btn" id="popupForm:popupFirstHref" name="popupForm:popupfirstHref"></button>
          </div>
          ...
      </div>
      
      

      And when the popup is paced inside the form, this button forces full (I mean "not AJAX") form submission, that results in page reloading. When form is placed inside the popup everithing works like indended (without page reloading).

      So, what is the puprose of this "firstHref" button and is there any way to solve this issue?

       

      P.S.: The popup was placed inside the form to solve autosizing issues.

        • 1. Re: rich:popupPanel form submission issue
          michpetrov

          If you want pressing Enter to behave the same way as clicking the commandButton you should set up a listener, otherwise the control is handed over the browser and that may not behave the way you want (I expect the browser always targets the first submit control in the form). I'll take a look on the hidden button.

          • 2. Re: rich:popupPanel form submission issue
            dfilippov

            Michal, thank you for answer, setting up a listener was the very first thought. Unfortunately, in my case it will require fixes in many places of legacy code. But I agree, setting up listener explicitly is more robust than relying on default browser behavior.

            Nevertheless, I am still curious about the purpose of this "firstHref" button