4 Replies Latest reply on Nov 11, 2010 12:46 AM by nigiyan

    problem with ajaxSingle=true

    nigiyan

      Hi, All

      My question is about a4j:ajaxSingle element - how it should work in simple/standard scenario described below.

       

      The problem is that not only element with ajax support is submitted, but others too. Below is also output of firebug tool post resuest. In a "Practical Richfaces" book it is written, that all form is still submitted, while only the lelement with ajaxSingle=true attribute will be processed. But here: http://docs.jboss.org/richfaces/latest_3_3_X/en/devguide/html_single/#AsvsjaxRequestOptimization it says opposite. So what to expect from version 3.3.3 or where am I mistaken?

       

      The simplified form of seam generated page:

       

      <h:form id="wb">

                  <h:panelGrid columns="2">


                      <h:outputLabel value="ID"/>
                      <h:inputText id="id"
                                   disabled="true"
                                   value="#{wbHome.instance.id}"/>


                      <h:outputLabel value="Fnm"/>
                      <h:inputText id="fnm"
                                   value="#{wbHome.instance.fnm}"/>


                      <h:outputLabel value="Lnm"/>
                      <h:inputText id="lnm"
                                   value="#{wbHome.instance.lnm}"/>


                      <h:outputLabel value="Cty"/>
                      <h:selectOneMenu id="cty" value="#{wbHome.instance.cty}">
                          <f:selectItems value="#{wbHome.ctyList}"/>
                      </h:selectOneMenu>


                      <h:outputLabel value="Adr"/>
                      <h:inputText id="adr"
                                   value="#{wbHome.instance.adr}">
                          <a:support id="support_for_adr" event="onchange" ajaxSingle="true"/>
                      </h:inputText>


                      <h:outputLabel value="Eml"/>
                      <h:inputText id="eml"
                                   value="#{wbHome.instance.eml}">
                          <a:support id="support_for_eml" event="onchange" ajaxSingle="true"/>
                      </h:inputText>


                  </h:panelGrid>

       

      </h:form>

       

      post resuest when "adr" content is changed:

       

      AJAXREQUEST    _viewRoot
      ajaxSingle    wb:adr
      javax.faces.ViewState    j_id2
      wb    wb
      wb:adr    address
      wb:eml    some email
      wb:fnm    fnm value
      wb:id   
      wb:lnm    lnm value
      wb:support_for_adr    wb:support_for_adr

       


        • 1. Re: problem with ajaxSingle=true
          nbelaevski

          Hi Aram,

           

          Book is right and documentation is wrong. The whole form is submitted. I've created a bug: https://jira.jboss.org/browse/RF-9775 - thank you for reporting the problem!

          • 2. Re: problem with ajaxSingle=true
            nigiyan

            Thanks for answer, Nick,

            I would prefer the documentation be correct, because in case of many elements in one form with richfaces ajax support this is really network traffic issue. These elements uses ajax requests for validation, dynamic data (e.g. combobox content) loading, etc..

            1. What should be done to decrease network traffic in this case?

            2. Is there possiblity to send single element in form using richfaces' ajax? If not, why?

             

            I'm not experienced in ajax technique but as I know ajax request/response possible without having a form and sending whole form in richfaces' ajax is strange for me.

             

            Thanks in advance.

            • 3. Re: problem with ajaxSingle=true
              ilya_shaikovsky

              it not possible because some components (even standard links) requires for example hidden inputs to be submitted with them. So we can't know at support level if the component requires just it's single input or some inputs more to be submitted to work correctly.

               

              Actually in the past we had ajaxSingle working as you want - but that causes issues even with standard components according to my explanation.

              • 4. Re: problem with ajaxSingle=true
                nigiyan

                ...I modified the xhtml file listed upper so that one form contains another with one ajax supporting element. And on ajax request from that element the parent's form data is also submitted...

                I think this is a lack in RichFaces' functionality you should agree with. Because I'm sure that not only our app has a big number of ajax supporting components in a form. So, is there any solution?