8 Replies Latest reply on Jun 26, 2007 4:27 PM by Matthew Fischer

    ajaxSingle with a4j:support - does it work?

    Matthew Fischer Newbie

      I've never been able to submit a single filed with a4j:support. Can anyone get this to work?

      Here's what I have and it seems the entire form is submitted everytime!

      <h:form title="QuickSearch">
      ...
      <t:panelGrid style="border:0; padding:0; margin: 0;">
       <t:radio for="userPrefs" index="0" />
       <a4j:outputPanel id="userOpts" layout="none">
       <t:div id="tbl" forceId="true" rendered="#{!visit.search.searchOptions.alwaysUse}" style="margin: 1px 0; padding: 5px; border: 1px solid #fc0; background-color: #fff;">
       <t:messages showDetail="true" showSummary="true" />
       <t:selectManyCheckbox id="quickOptions" forceId="true" layout="pageDirection" value="#{advancedExploreUtilsBean.quickExploreOptions}" style="text-align: left;" title="#{bundle.quickExplore} #{bundle.options}">
       <f:selectItem itemValue="RF" itemLabel="Royalty Free" />
       <f:selectItem itemValue="RM" itemLabel="Rights Managed" />
       </t:selectManyCheckbox>
       </t:div>
       </a4j:outputPanel>
       <t:radio for="userPrefs" index="1" />
      </t:panelGrid>
      ...
      </h:form>




        • 1. Re: ajaxSingle with a4j:support - does it work?
          Sergey Smirnov Master

          I did not see a4j:support in your code snippet

          • 2. Re: ajaxSingle with a4j:support - does it work?
            Matthew Fischer Newbie

            Ooops! Sorry about that...here it is

            <h:form title="QuickSearch">
            ...
            <t:selectOneRadio value="#{visit.search.searchOptions.alwaysUse}"
             id="userPrefs" forceId="true" layout="spread">
             <f:selectItem itemValue="#{false}"
             itemLabel="#{bundle.quickExplore} #{bundle.options}" />
             <f:selectItem itemValue="#{true}" itemLabel="#{bundle.qeUsePrefs}"
             itemDisabled="#{!visit.loggedIn}" />
             <a4j:support event="onclick" reRender="userOpts" ajaxSingle="true"/>
            </t:selectOneRadio>
            
            <t:panelGrid style="border:0; padding:0; margin: 0;">
             <t:radio for="userPrefs" index="0" />
             <a4j:outputPanel id="userOpts" layout="none">
             <t:div id="tbl" forceId="true" rendered="#{!visit.search.searchOptions.alwaysUse}" style="margin: 1px 0; padding: 5px; border: 1px solid #fc0; background-color: #fff;">
             <t:messages showDetail="true" showSummary="true" />
             <t:selectManyCheckbox id="quickOptions" forceId="true" layout="pageDirection" value="#{advancedExploreUtilsBean.quickExploreOptions}" style="text-align: left;" title="#{bundle.quickExplore} #{bundle.options}">
             <f:selectItem itemValue="RF" itemLabel="Royalty Free" />
             <f:selectItem itemValue="RM" itemLabel="Rights Managed" />
             </t:selectManyCheckbox>
             </t:div>
             </a4j:outputPanel>
             <t:radio for="userPrefs" index="1" />
            </t:panelGrid>
            ...
            </h:form>
            


            • 3. Re: ajaxSingle with a4j:support - does it work?
              Sergey Smirnov Master

              so, what a4j:log says about the request params when user clicks the radio?

              • 4. Re: ajaxSingle with a4j:support - does it work?
                Matthew Fischer Newbie

                Here's what I captured...clicked each radio button once.

                debug[15:11:53,706]: Have Event [object Object] with properties: target: undefined, srcElement: [object], type: click
                debug[15:11:53,721]: NEW AJAX REQUEST !!! with form :quickExplore:_idJsp76
                debug[15:11:53,737]: parameter quickExplore:_idJsp76:_idJsp86 with value quickExplore:_idJsp76:_idJsp86
                debug[15:11:53,737]: Start XmlHttpRequest
                debug[15:11:53,753]: Reqest state : 1
                debug[15:11:53,753]: QueryString: AJAXREQUEST=_viewRoot&autoScroll=&quickExplore%3A_idJsp76_SUBMIT=1&quickExplore%3A_idJsp76%3A_link_hidden_=&quickExplore%3A_idJsp76%3A_idcl=&javax.faces.ViewState=rO0ABXVyABNbTGphdmEubGFuZy5PYmplY3Q7kM5YnxBzKWwCAAB4cAAAAAN0AAExcHQADC93ZWxjb21lLmpzcA%3D%3D&userPrefs=false&quickExplore%3A_idJsp76%3A_idJsp86=quickExplore%3A_idJsp76%3A_idJsp86&
                debug[15:11:53,768]: Reqest state : 1
                debug[15:11:54,362]: Reqest state : 2
                debug[15:11:54,378]: Reqest state : 3
                debug[15:11:54,393]: Reqest state : 4
                debug[15:11:54,393]: Reqest end with state 4
                debug[15:11:54,409]: Response with content-type: text/xml;charset=UTF-8
                debug[15:11:54,409]: Full response content: <?xml version="1.0"?>
                <html lang="en_US" xmlns="http://www.w3.org/1999/xhtml"><head><title></title><script type="text/javascript" src="/ngsimages/a4j.res/org.ajax4jsf.framework.ajax.AjaxScript.jsf">
                </script></head><body><div id="tbl" style="margin: 1px 0; padding: 5px; border: 1px solid #fc0; background-color: #fff;"><table style="text-align: left;" id="quickOptions"><tbody><tr><td><label><input type="checkbox" name="quickOptions" checked="checked" value="RF" title="QuickExplore Options" style="text-align: left;" /> Royalty Free</label></td></tr><tr><td><label><input type="checkbox" name="quickOptions" checked="checked" value="RM" title="QuickExplore Options" style="text-align: left;" /> Rights Managed</label></td></tr></tbody></table></div><meta name="Ajax-Update-Ids" content="tbl,quickExplore:_idJsp76:userOpts" /><span id="ajax-update-ids"><input type="hidden" name="jsf_sequence" value="2" /><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="rO0ABXVyABNbTGphdmEubGFuZy5PYmplY3Q7kM5YnxBzKWwCAAB4cAAAAAN0AAEycHQADC93ZWxjb21lLmpzcA==" /></span><meta id="Ajax-Response" name="Ajax-Response" content="true" /><!-- MYFACES JAVASCRIPT -->
                <script type="text/javascript"><!-- function getScrolling() {
                 var x = 0; var y = 0;if (self.pageXOffset || self.pageYOffset) {
                 x = self.pageXOffset; y = self.pageYOffset; }
                 else if ((document.documentElement && document.documentElement.scrollLeft)||(document.documentElement && document.documentElement.scrollTop))
                 { x = document.documentElement.scrollLeft;
                 y = document.documentElement.scrollTop; } else if (document.body) {
                 x = document.body.scrollLeft; y = document.body.scrollTop; }
                 return x + "," + y; } //--></script></body></html>
                debug[15:11:54,425]: Update page by list of rendered areas from response tbl,quickExplore:_idJsp76:userOpts
                debug[15:11:54,440]: search for elements by name 'script' in element #document
                debug[15:11:54,440]: selectNodes found 2
                debug[15:11:54,456]: <script> in response with src=/ngsimages/a4j.res/org.ajax4jsf.framework.ajax.AjaxScript.jsf
                debug[15:11:54,456]: Such element exist in document
                debug[15:11:54,471]: search for elements by name 'link' in element #document
                debug[15:11:54,471]: selectNodes found 0
                debug[15:11:54,487]: Attempt to update part of page for Id: tbl
                debug[15:11:54,503]: call selectSingleNode for id= tbl
                debug[15:11:54,518]: Replace content of node by outerHTML()
                debug[15:11:54,518]: search for elements by name 'script' in element div
                debug[15:11:54,534]: selectNodes found 0
                debug[15:11:54,534]: Scripts in updated part count : 0
                debug[15:11:54,550]: Update part of page for Id: tbl successful
                debug[15:11:54,550]: Attempt to update part of page for Id: quickExplore:_idJsp76:userOpts
                debug[15:11:54,565]: call selectSingleNode for id= quickExplore:_idJsp76:userOpts
                error[15:11:54,565]: New node for ID quickExplore:_idJsp76:userOpts is not present in response
                debug[15:11:54,581]: call selectSingleNode for id= ajax-update-ids
                debug[15:11:54,596]: Hidden JSF state fields:
                debug[15:11:54,596]: search for elements by name 'input' in element span
                debug[15:11:54,612]: selectNodes found 2
                debug[15:11:54,628]: Replace value for inputs: 38 by new values: 2
                debug[15:11:54,628]: Input in response: jsf_sequence
                debug[15:11:54,643]: Input in response: javax.faces.ViewState
                debug[15:11:54,659]: Found same input on page with type: hidden
                debug[15:11:54,659]: Found same input on page with type: hidden
                debug[15:11:54,675]: Found same input on page with type: hidden
                debug[15:11:54,675]: Found same input on page with type: hidden
                debug[15:11:54,690]: Found same input on page with type: hidden
                debug[15:11:54,706]: Found same input on page with type: hidden
                debug[15:11:54,706]: search for elements by name 'INPUT' in element span
                debug[15:11:54,721]: selectNodes found 0
                debug[15:11:54,737]: Replace value for inputs: 38 by new values: 0
                debug[15:12:00,487]: Have Event [object Object] with properties: target: undefined, srcElement: [object], type: click
                debug[15:12:00,487]: NEW AJAX REQUEST !!! with form :quickExplore:_idJsp76
                debug[15:12:00,503]: parameter quickExplore:_idJsp76:_idJsp86 with value quickExplore:_idJsp76:_idJsp86
                debug[15:12:00,518]: Start XmlHttpRequest
                debug[15:12:00,534]: Reqest state : 1
                debug[15:12:00,534]: QueryString: AJAXREQUEST=_viewRoot&autoScroll=&quickExplore%3A_idJsp76_SUBMIT=1&quickExplore%3A_idJsp76%3A_link_hidden_=&quickExplore%3A_idJsp76%3A_idcl=&javax.faces.ViewState=rO0ABXVyABNbTGphdmEubGFuZy5PYmplY3Q7kM5YnxBzKWwCAAB4cAAAAAN0AAEycHQADC93ZWxjb21lLmpzcA%3D%3D&userPrefs=true&quickExplore%3A_idJsp76%3A_idJsp86=quickExplore%3A_idJsp76%3A_idJsp86&
                debug[15:12:00,550]: Reqest state : 1
                debug[15:12:00,784]: Reqest state : 2
                debug[15:12:00,800]: Reqest state : 3
                debug[15:12:00,800]: Reqest state : 4
                debug[15:12:00,815]: Reqest end with state 4
                debug[15:12:00,831]: Response with content-type: text/xml;charset=UTF-8
                debug[15:12:00,831]: Full response content: <?xml version="1.0"?>
                <html lang="en_US" xmlns="http://www.w3.org/1999/xhtml"><head><title></title><script type="text/javascript" src="/ngsimages/a4j.res/org.ajax4jsf.framework.ajax.AjaxScript.jsf">
                </script></head><body><span id="tbl" style="display: none;"></span><meta name="Ajax-Update-Ids" content="tbl,quickExplore:_idJsp76:userOpts" /><span id="ajax-update-ids"><input type="hidden" name="jsf_sequence" value="3" /><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="rO0ABXVyABNbTGphdmEubGFuZy5PYmplY3Q7kM5YnxBzKWwCAAB4cAAAAAN0AAEzcHQADC93ZWxjb21lLmpzcA==" /></span><meta id="Ajax-Response" name="Ajax-Response" content="true" /><!-- MYFACES JAVASCRIPT -->
                <script type="text/javascript"><!-- function getScrolling() {
                 var x = 0; var y = 0;if (self.pageXOffset || self.pageYOffset) {
                 x = self.pageXOffset; y = self.pageYOffset; }
                 else if ((document.documentElement && document.documentElement.scrollLeft)||(document.documentElement && document.documentElement.scrollTop))
                 { x = document.documentElement.scrollLeft;
                 y = document.documentElement.scrollTop; } else if (document.body) {
                 x = document.body.scrollLeft; y = document.body.scrollTop; }
                 return x + "," + y; } //--></script></body></html>
                debug[15:12:00,846]: Update page by list of rendered areas from response tbl,quickExplore:_idJsp76:userOpts
                debug[15:12:00,862]: search for elements by name 'script' in element #document
                debug[15:12:00,878]: selectNodes found 2
                debug[15:12:00,878]: <script> in response with src=/ngsimages/a4j.res/org.ajax4jsf.framework.ajax.AjaxScript.jsf
                debug[15:12:00,893]: Such element exist in document
                debug[15:12:00,893]: search for elements by name 'link' in element #document
                debug[15:12:00,909]: selectNodes found 0
                debug[15:12:00,909]: Attempt to update part of page for Id: tbl
                debug[15:12:00,925]: call selectSingleNode for id= tbl
                debug[15:12:00,940]: Replace content of node by outerHTML()
                debug[15:12:00,940]: search for elements by name 'script' in element span
                debug[15:12:00,956]: selectNodes found 0
                debug[15:12:00,971]: Scripts in updated part count : 0
                debug[15:12:00,971]: Update part of page for Id: tbl successful
                debug[15:12:00,987]: Attempt to update part of page for Id: quickExplore:_idJsp76:userOpts
                debug[15:12:01,003]: call selectSingleNode for id= quickExplore:_idJsp76:userOpts
                error[15:12:01,003]: New node for ID quickExplore:_idJsp76:userOpts is not present in response
                debug[15:12:01,018]: call selectSingleNode for id= ajax-update-ids
                debug[15:12:01,018]: Hidden JSF state fields:
                debug[15:12:01,034]: search for elements by name 'input' in element span
                debug[15:12:01,050]: selectNodes found 2
                debug[15:12:01,050]: Replace value for inputs: 36 by new values: 2
                debug[15:12:01,065]: Input in response: jsf_sequence
                debug[15:12:01,081]: Input in response: javax.faces.ViewState
                debug[15:12:01,096]: Found same input on page with type: hidden
                debug[15:12:01,096]: Found same input on page with type: hidden
                debug[15:12:01,112]: Found same input on page with type: hidden
                debug[15:12:01,112]: Found same input on page with type: hidden
                debug[15:12:01,128]: Found same input on page with type: hidden
                debug[15:12:01,143]: Found same input on page with type: hidden
                debug[15:12:01,143]: search for elements by name 'INPUT' in element span
                debug[15:12:01,159]: selectNodes found 0
                debug[15:12:01,159]: Replace value for inputs: 36 by new values: 0


                • 5. Re: ajaxSingle with a4j:support - does it work?
                  Sergey Smirnov Master

                  what the version of ajax4jsf you use?

                  • 6. Re: ajaxSingle with a4j:support - does it work?
                    Matthew Fischer Newbie

                    I apologize for the delay...was out of the office all weekend (thankfully!).

                    I am using ajax4jsf-1.1.0.jar - downloaded from the jboss site. From the properties I see it was Created: Thursday, March 01, 2007, 8:33:34 PM and Modified: Wednesday, March 07, 2007, 4:45:49 PM.

                    • 8. Re: ajaxSingle with a4j:support - does it work?
                      Matthew Fischer Newbie

                      Sergey -

                      You are a gentleman and a scholar...that did the trick!! Thanks for the help!

                      I know better...I should have checked for a newer version first (didn't know 1.1.1 was out!).

                      Anyhow, nice to see ajaxSingle working and I will put it to good use...once again sorry for the delays in response...we were having production issues since Sunday (I became aware of them on Monday!).

                      Matt