4 Replies Latest reply on Nov 8, 2007 12:25 PM by Petros D

    rich:suggestionbox submits the whole form -> validation erro

    Petros D Newbie

      Hi,

      i am new in richfaces and have a question.

      I just created a simple form with some fields including one suggestionbox element.
      The problem i have is, when i start typing in the autocomplete field, the whole form is getting submitted and validation errors are appearing.
      Is there any way to submit only the autocmplete field? or skip the form submition?
      I tried using ajaxSingle but it didnt work.

      Thanks you for your help!

      here my form:

      <h:form>

      <h:outputText value="${bundle['sample.form.name']}:" />
      <h:inputText label="Name" id="name" required="true"
      value="#{SimpleFormController.bean.userName}"
      styleClass="defaultTextfield">
      <f:validateLength minimum="3" />
      </h:inputText>

      <h:outputText value="Country with ajax" />
      <h:inputText label="Country" id="country_ajax" required="true"
      value="#{SimpleFormController.bean.userCountry}"
      styleClass="defaultTextfield"/>
      <rich:suggestionbox id="suggestionBoxId" for="country_ajax" nothingLabel="Nothing found"
      suggestionAction="#{ListUtil.autocompleteCountry}" var="result" ajaxSingle="true"
      minChars="1"
      shadowOpacity="4"
      border="1" width="200"
      height="300"
      shadowDepth="1"
      cellpadding="0">
      <h:column>
      <h:outputText value="#{result}" />
      </h:column>
      </rich:suggestionbox>

      <h:commandButton value="Submit"
      action="#{SimpleFormController.doSubmit}"
      styleClass="defaultButton" />

      </h:form>