5 Replies Latest reply on Mar 8, 2007 5:34 PM by Sergey Smirnov

    suggestionbox question

    Alexander Furer Newbie

      Hello
      I have complex criteria and on of it's components is input filed with
      suggestionbox. On server side i want to be able to lookup database by
      prefix entered in input field and by other criteria control values.
      My question is :
      How can i send other criteria controls values with suggestionbox ajax request.

      Thanks.

        • 1. Re: suggestionbox question
          Damian Harvey Master

          I am also very interested in this. I had it working with IceFaces so I'm sure that it's also possible with RichFaces.

          One way to get around it would be to store the value 'suggested' in an object which is then injected into the Bean where you perform the operation (eg. into the EntityHome bean when calling persist).

          Sorry I can't be of more help.

          Damian.

          • 2. Re: suggestionbox question
            Damian Harvey Master

            ...oh, and I meant to say that in the intended operation you can look up the Object from the suggestion box based on it's value. Mind you this is only really helpful if you store the ID.

            • 3. Re: suggestionbox question
              Sergey Smirnov Master

              Curiously, but we disabled this feature explicitly.

              See:

              http://anonsvn.jboss.org/repos/richfaces/trunk/richfaces/suggestionbox/src/main/config/component/suggestionbox.xml


              Exactly here:

              <property hidden="true">
               <name>ajaxSingle</name>
               <classname>boolean</classname>
               <description>
               if true, submit ONLY one field/link, instead of all
               form controls
               </description>
               <defaultvalue>true</defaultvalue>
               </property>
              


              So, if we remove hidden="true" from this configuration file, suggestionBox will obtain the attribute ajaxSingle. If ajaxSingle="false", the other fields of the form (or ones that are limited with a4j:region) will be processed and available in the suggestionAction.
              However, if the validation problems occur on other fields, the action will not invoked and the suggestion stops to work. This use case was the motivation why this option is disables

              Another possible way to go is having "process" attribute on the Ajax Components. This attribute will allow to point to the components that will be processed while the ajaxSingle is set to true.

              Having "process" attribute is more safer way. "process" is also in our TODO list, but not on the first position (first priority is a portals support).

              So, what the approach you are voting for?




              • 4. Re: suggestionbox question
                Alexander Furer Newbie

                I vote for ajaxSingle=false/true.
                If one of the form components is invalid, user will get validation error message later, while trying to submit the form, i don't see the benefit from letting him to choose the value with suggestion box at this stage. Submitting all form fields is common and general behavior...

                If you decide to pick this approach, please, describe this validation issue in documentation and suggest to have

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

                on every page with ajax support.

                Is this enhancement targeted to the nearest release?
                When do you plan to have it?
                Thanks


                • 5. Re: suggestionbox question
                  Sergey Smirnov Master

                  The changes are already is SVN. So, the feature will be included in the nearest build.

                  We are in the middle of moving the Maven repo from java.net to jboss.org . As soon as this will be done, anybody can obtain the latest version having just Maven installed.