0 Replies Latest reply on Mar 25, 2008 3:27 PM by Joe Greene

    a4j:form fields not updating when using required=

    Joe Greene Novice

      Hi -
      I'm using a rich:suggestionbox like this:

      <a4j:region>
      <h:inputText value="#{adminHelperBean.property}" id="searchUserText" />
      <!-- suggestion box for Search feature -->
      <rich:suggestionbox id="suggestionBoxId" for="searchUserText"
       tokens=",[" rules="all"
       suggestionAction="#{adminHelperBean.autocomplete}" var="result"
       fetchValue="#{result.username}" first="0" minChars="1"
       shadowOpacity="4" border="1" width="200" height="200"
       frequency="0" shadowDepth="4" cellpadding="2" cellspacing="2">
       <h:column>
       <h:outputText value="#{result.username}" />
       </h:column>
       <h:column>
       <h:outputText value="#{result.lastNameFirst}" />
       </h:column>
       <a4j:support event="onselect" ajaxSingle="false"
       action="#{adminHelperBean.selectUser(result.username)}"
       reRender="userAdminUserConsole" />
       </rich:suggestionbox>
       <h:outputLabel for="searchUserText" value="Search Users" style="margin-left: 4px;" />
       </a4j:region>
      


      This is inside an a4j:form, along with some other fields. Under normal operation, everything works fine. Here is the problem:

      If I do a user search using the suggestionbox, the data for the user I select is successfully populated in the fields. Some of the fields have required="true". If I wipe out the contents of one of the required fields, then hit Submit, the validation works fine by displaying the appropriate error message. At this point, if I now discontinue working with this user data, and instead go back to the suggestionbox to search for another user, and select a new user, the only fields that get updated with the new user's data are those that had a validation error (in my example, the field that I wiped out is the only one that gets updated). The other fields remain populated with the previous user's data. So the net effect is that the data in the form is a mix of two users at this point. From debugging, I can tell that the real user object on the server gets updated correctly. Therefore, it looks as if the problem is that the other fields (those with no validation error) are not being rerendered. If I don't use required="true" and don't use @NotNull annotations on the fields, there is no problem. All data gets updated correctly when I change users. I'm using the a4j:region tag because of the following issue:

      http://jira.jboss.org/jira/browse/RF-2355

      One other fact that might be important - the user data fields are all wrapped with a rich:tabPanel component, which is itself in the a4j:form.

      Has anyone experienced this before? Sorry for the long description. Any help would be greatly appreciated.

      - Joe