5 Replies Latest reply on Jun 11, 2010 8:51 AM by Tom Todaro

    Problem with suggestionBox

    Tom Todaro Newbie

      I've done a lot of Web research to get the following to work, but it's  just not working. I have a SuggestionBox on my form. It retrieves the  suggested values perfectly. It shows the list. It populates the box with  my fetch value. The problem is that I simply cannot get the setPropertyActionListener event to fire no matter what I do. Nothing happens. No error messages.  I've also tried binding the input box to the property, but that doesn't fire either. I have no trouble getting selectOneMenu selections to fire; it's just the suggestionBox that is driving me crazy!


      One other clue: if I do a search on 123, select something, and  then do another search on 5678, I get a  ConcurrentModificationException. When I debug, the breakpoint on the  second search is actually searching for 123 again, and then the  next breakpoint on that method is for the 5678 search. Can't  figure out why the second search is triggering two searches on two  different strings.


      Seam 2.0.2.SP1

      Richfaces 3.2.2.SR1

      Facelets 1.1.14

      Firefox 3.6


      <h:outputText value="Model Search: " />
      <h:inputText id="mod"/>     
         <rich:suggestionbox width="500" for="mod" var="result" fetchValue="#{result.fullDescription}" minChars="3"     immediate="true"
                   <h:outputText value="#{result.fullDescription}" />
           <a4j:support event="onselect" eventsQueue="q1" immediate="true">
                      <f:setPropertyActionListener value="#{result}" target="#{siteManager.searchModel}" />
        • 1. Re: Problem with suggestionBox
          Tom Todaro Newbie

          Bump. Any ideas about the event not firing?

          • 2. Re: Problem with suggestionBox
            Ilya Shaikovsky Master

            1) check 3.3.3Final.

            2) remove just to check all immediate attributes.

            1 of 1 people found this helpful
            • 3. Re: Problem with suggestionBox
              Tom Todaro Newbie

              Hi, I did a little more checking, and I discovered the following error in my Firefox error console whenever I select something from the suggestion list:


              Error: this._form is null
              Source File: xxxxxxx/a4j/g/3_2_2.SR1org.ajax4jsf.javascript.AjaxScript
              Line: 178


              elem=document.getElementById(targetID+".stop");if(elem){elem.style.display="";if(typeof(elem.onstop)=='function'){elem.onstop();}}}}catch(e){LOG.error("Exception on status change: ");}};A4J.Query=function(containerId,form){this._query={AJAXREQUEST:containerId};this._oldSubmit=null;this._form=form;this._actionUrl=(this._form.action)?this._form.action:this._form;};A4J.Query.prototype={_form:null,_actionUrl:null,_ext:"",_query:{},_oldSubmit:null,_pageBase:window.location.protocol+"//"+window.location.host,hidden:function(control){this._value_query(control);if((control.name.length>4)&&(control.name.lastIndexOf("_idcl")==(control.name.length-5))){control.value="";}else if((control.name.length>12)&&(control.name.lastIndexOf("_link_hidden_")==(control.name.length-13))){control.value="";}},text:function(control){this._value_query(control);},textarea:function(control){this._value_query(control);},'select-one':function(control){if(control.selectedIndex!=-1){this._value_query(control);}},password:function(control){this._value_query(control);},file:function(control){this._value_query(control);},radio:function(control){this._check_query(control);},checkbox:function(control){this._check_query(control);},'select-multiple':function(control){var cname=control.name;var options=control.options;for(var i=0;i<control.length;i++){var option=options[i];this._addOption(cname,option);}},_addOption:function(cname,option){if(option.selected){if(!this._query[cname]){this._query[cname]=[];}

              And, if I use a4j:log, as soon as I click on the suggested value, the log adds the following:



              debug[20:51:26,399]: Have  Event [object Object] with properties: target: [object  HTMLTableCellElement], srcElement: undefined, type: click
              debug[20:51:26,399]: NEW AJAX REQUEST  !!! with form :mainbodyForm:priceForm
              • 4. Re: Problem with suggestionBox
                Ilya Shaikovsky Master

                please attach real not simplified page snippet. also check that forms present for all submitting components and that not forms nested.

                • 5. Re: Problem with suggestionBox
                  Tom Todaro Newbie

                  Nested forms! That was the problem. Our pages use a template as follows:


                  <ui:composition template="template.xhtml">   
                          <ui:param name="title" value="IBI Price Calculator"/>
                          <ui:define name="mainmenu"></ui:define>
                          <ui:define name="mainbody">
                              <rich:messages layout="list" ajaxRendered="true"
                                       fatalClass="errorMessage" />



                  In template.xhtml:


                              <h:form id="mainbodyForm">
                                  <ui:insert name="mainbody">content</ui:insert>



                  My page also had a form. I hadn't realized that I was introducing a nested form because of the template. Once I removed my form tags, everything worked.


                  Thank you for the 'nested form' hint!