4 Replies Latest reply on Jan 28, 2009 4:24 AM by ilya_shaikovsky

    Suggestionbox popup is still visible after submitting and re

    ande

      I am using a rich:suggestionbox with an inputfield which submits the form after the enter key was pressed.
      If I press the enter key before the suggestionbox pops up, the form gets submitted and after rerendering the suggestionbox popup is still visible sometimes. (Also the a4j:status is sometimes not correctly finished)

      How can I avoid that?
      I tried a4j:queue with requestDelay=1000 but it seems that this is not a good option because now every request in this form gets delayed.

      Any suggestions how i can get rid of my problem?

      I am using RF 3.3.0GA

      Thanks in advance,
      Ande

        • 1. Re: Suggestionbox popup is still visible after submitting an
          ilya_shaikovsky

          show please your page. I'm interesting in your form submit via enter implementation.

          • 2. Re: Suggestionbox popup is still visible after submitting an
            ande

            Here we go:

            Facelet:

            ...
            <h:inputText id="newTestDriveActivityTCInput" value="#{bean.newTestDriveActivityTC}"
            onkeyup="clickElementByReturn('newtdactivityform:newtdactivityinputsubmit', event)" />
            <a4j:region>
             <rich:suggestionbox id="newTestDriveActivityTCInputSuggest" for="newTestDriveActivityTCInput"
            suggestionAction="#{bean.testDriveTestCasesAutocomplete}" var="tdtc" fetchValue="#{tdtc.id}" width="500"
            height="200" nothingLabel="#{msgs['tt.nothingfound']}" ignoreDupResponses="true">
             <h:column>
             <h:outputText id="newTestDriveActivityTCInputSuggestValue" value="#{tdtc.id} - #{tdtc.category} - #{tdtc.title}"/>
             </h:column>
             </rich:suggestionbox>
            </a4j:region>
            <h:inputText styleClass="hidden" />
            <a4j:commandButton id="newtdactivityinputsubmit" value="#{msgs['tt.save']}" action="#{bean.saveNewTestDriveActivity}"
            reRender="testdriveactivities" status="ttstatus" oncomplete="focusElement('newtdactivityform:newTestDriveActivityTimeInput');"
            onclick="disableElem(this);" />
            ...
            



            and js:

            function clickElementByReturn(elid, e) {
            var kC = (window.event) ? event.keyCode : e.keyCode;
            var enter_key = (window.event) ? 13 : e.DOM_VK_RETURN;
            if(kC == enter_key) {
            $(elid).click();
            }
            }



            • 3. Re: Suggestionbox popup is still visible after submitting an
              ande

              Pushed. :)

              • 4. Re: Suggestionbox popup is still visible after submitting an
                ilya_shaikovsky

                what about use the named queue? Just for input and this button which you clicking from js? Other controls will not be affected and these ones will be in queue? check our dev guide article for named queues creation.