6 Replies Latest reply on Jun 28, 2007 7:01 AM by Ilya Shaikovsky

    a4j:support within rich:suggestionbox

    ter ron Newbie

      Hello,

      In a facelets page I have a form with (among others)

      <h:inputText value="#{manBean.impValue}" id="val1" required="true"/>
      
      <h:inputText value="#{manBean.impValue2}"/>
      <rich:suggestionbox for="su1e" suggestionAction="#{manBean.autocomplete}" var="suggest">
       <h:column> <h:outputText value="#{suggest}"/> </h:column>
       <a4j:support event="onselect" reRender="val3" immediate="true"/>
      </rich:suggestionbox>
      
      <h:inputText value="#{manBean.impValue3}" id="val3"/>
      


      If I take out the required from the first inputText, all work as desired. The user select from the suggestionbox and the a4j:support rerender the inputText val3.

      Now, as soon as the inputText val1 has the reuired="true" and it has no text inside the field, the reRender is not working.

      Is pretty clear that the required attribute is stopping the ajax rendering from working, but how do I avoid that "required check" until the complete page is being submitted?

      I tried with ajaxSingle on the a4j:support but that's not doing it. When I read the explanation I thoght that was it
      ajaxSingle: if true , submits ONLY one field/link, instead of all form controls.


      Thanks for any idea!

        • 1. Re: a4j:support within rich:suggestionbox
          Ilya Shaikovsky Master

          around please your input with suggestion to a4j:region with renderRegionOnly = false.

          • 2. Re: a4j:support within rich:suggestionbox
            ter ron Newbie

            Thanks Ilya, that's doing it!

            That doesn't mean that I understood why :)

            could you give an explanation? region but renderRegionOnly = false !?

            Thanks!

            • 4. Re: a4j:support within rich:suggestionbox
              Sheldon s Newbie

              hi, I am trying to do something similar but it doesn't work for me. Here is the view code:

              <h:form>
              ...
               <table width="580" border="0" cellspacing="0" cellpadding="0">
              
               <tr>
               <td align="center">
               <div id="enterBusiness">
              
               <s:decorate id="businessTitleDecoration" template="layout/edit.xhtml">
               <ui:define name="label">Business name</ui:define>
               <h:inputText id="businessTitle" required="true"
               size="36"
               maxlength="128"
               value="#{suggestionBox.businessTitle}">
               </h:inputText>
               </s:decorate>
              
               <rich:suggestionbox for="businessTitle" tokens=",["
               rules="#{suggestionBox.rules}"
               suggestionAction="#{suggestionBox.suggestBusinesses}" var="result"
               fetchValue="#{result.title}" rows="#{suggestionBox.intRows}"
               first="#{suggestionBox.intFirst}"
               minChars="3"
               shadowOpacity="#{suggestionBox.shadowOpacity}"
               border="0" width="#{suggestionBox.width}"
               height="#{suggestionBox.height}" selectValueClass="suggestionBoxSelectedRow"
               shadowDepth="#{suggestionBox.shadowDepth}"
               cellpadding="#{suggestionBox.cellpadding}"
               ignoreDupResponses="true" requestDelay="300" styleClass="suggestionBox">
               <h:column>
               <h:outputText value="#{result.title}"/>
               </h:column>
               <a:support reRender="phoneDecoration" event="onselect" immediate="true"/>
               </rich:suggestionbox>
               <a:region renderRegionOnly="false">
               <s:decorate id="phoneDecoration" template="layout/edit.xhtml">
               <ui:define name="label">Phone</ui:define>
               <h:inputText id="businessPhone" required="true"
               size="36"
               maxlength="128"
               value="#{suggestionBox.businessPhone}"/>
               <h:inputHidden id="businessId" value="#{suggestionBox.businessId}"/>
               </s:decorate>
               </a:region>
               </div>
               </td>
               </tr>
              
               <tr>
               <td align="center" height="40">
              
               <h:commandButton id="save"
               value="Save"
               action="#{suggestionBox.process}"/>
              
              
               </td>
               </tr>
               </table>
              ...
              </h:form>
              


              I am trying to submit the form and load the businessPhone and businessId fields of suggestionBox bean based on the selected row in suggestionbox, and then refresh those two fields in view. But the form was never submitted on select event. Am I doing it right? BTW I get access error trying to follow the url. Thanks.

              • 5. Re: a4j:support within rich:suggestionbox
                Sheldon s Newbie

                hi, I am trying to do something similar but it doesn't work for me. Here is the view code:

                <h:form>
                ...
                 <table width="580" border="0" cellspacing="0" cellpadding="0">
                
                 <tr>
                 <td align="center">
                 <div id="enterBusiness">
                
                 <s:decorate id="businessTitleDecoration" template="layout/edit.xhtml">
                 <ui:define name="label">Business name</ui:define>
                 <h:inputText id="businessTitle" required="true"
                 size="36"
                 maxlength="128"
                 value="#{suggestionBox.businessTitle}">
                 </h:inputText>
                 </s:decorate>
                
                 <rich:suggestionbox for="businessTitle" tokens=",["
                 rules="#{suggestionBox.rules}"
                 suggestionAction="#{suggestionBox.suggestBusinesses}" var="result"
                 fetchValue="#{result.title}" rows="#{suggestionBox.intRows}"
                 first="#{suggestionBox.intFirst}"
                 minChars="3"
                 shadowOpacity="#{suggestionBox.shadowOpacity}"
                 border="0" width="#{suggestionBox.width}"
                 height="#{suggestionBox.height}" selectValueClass="suggestionBoxSelectedRow"
                 shadowDepth="#{suggestionBox.shadowDepth}"
                 cellpadding="#{suggestionBox.cellpadding}"
                 ignoreDupResponses="true" requestDelay="300" styleClass="suggestionBox">
                 <h:column>
                 <h:outputText value="#{result.title}"/>
                 </h:column>
                 <a:support reRender="phoneDecoration" event="onselect" immediate="true"/>
                 </rich:suggestionbox>
                 <a:region renderRegionOnly="false">
                 <s:decorate id="phoneDecoration" template="layout/edit.xhtml">
                 <ui:define name="label">Phone</ui:define>
                 <h:inputText id="businessPhone" required="true"
                 size="36"
                 maxlength="128"
                 value="#{suggestionBox.businessPhone}"/>
                 <h:inputHidden id="businessId" value="#{suggestionBox.businessId}"/>
                 </s:decorate>
                 </a:region>
                 </div>
                 </td>
                 </tr>
                
                 <tr>
                 <td align="center" height="40">
                
                 <h:commandButton id="save"
                 value="Save"
                 action="#{suggestionBox.process}"/>
                
                
                 </td>
                 </tr>
                 </table>
                ...
                </h:form>
                


                I am trying to submit the form and load the businessPhone and businessId fields of suggestionBox bean based on the selected row in suggestionbox, and then refresh those two fields in view. But the form was never submitted on select event. Am I doing it right? BTW I get access error trying to follow the url. Thanks.

                • 6. Re: a4j:support within rich:suggestionbox
                  Ilya Shaikovsky Master

                  1) access error was solved in the snapshots.

                  2) please put

                  <a:outputPanel ajaxRendered="true">
                  <h:messages/>
                  </a:outputPanel>
                  

                  somewhere in your form