1 Reply Latest reply on May 9, 2010 4:07 AM by karlkras

    picklist and ajax rerender.

    karlkras

      Hello again,

      So here's this week's question about using rich:pickList.

      I have a wizard like interface that contains back, next, cancel commandbuttons, respectfully.

      My want is to keep the Next button disabled (disabled="true") until such time that the user has provided input for required fields.

      My approach of this has been ...

      For each input control, do this:

      <a4j:support event="onchange" reRender="nextbutton" />

       

      and the set* method in the bean will call a routine to check if all required elements have data in them, e.g.,:

      void areRequirementsMet() {

      if(getDescription().length > 0 && getFileTypes().size() > 0) {

          setDisable(false)

      } else {

         setDisable(true);

      }

       

      so after the the onchange event for the control, it sets the value and makes the call, e.g.,

       

         public void setFileTypes(List<String> fileTypes) {
              this.fileTypes = fileTypes;
              areRequirementsMet();
         }

       

      after which point (at least the plan) is to then have the rerender of the next button and change context on when requirements met.

      Problem is, I can't get this to work with picklist controls... here's what I'm trying:

       

      <rich:pickList id="filetypes" value="#{mybean.filetypes}">
         <f:selectItems value="#{mybean.filetypeItemsAvailable}" />
         <a4j:support event="onchange" reRender="nextbutton" />
      </rich:pickList>

       

      But it would seem that the onchange doesn't appear to be getting picked up as I would have hoped and the call reRender never takes place.

       

      I'm doing this like this:

       

      <h:selectOneMenu value="#{mybean.companyID}">
         <f:selectItems value="#{myBeans.companyItemsAvailable}" />
         <a4j:support ajaxSingle="true" event="onchange" reRender="nextbutton" />
      </h:selectOneMenu>

       

      for a standard selectOneMenu and works like a champ so I assumed it would function in a similar manner. Apparently not. Can anyone help on this?