title: Clear form field when validation on other field fails
body: <p>I need to clear an input text from validator when validation on other field fails. I've tried using the <code>setSubmittedValue("")</code> or <code>setValue("")</code>, but it's not working.</p>
  
  <p>The reason I want to do that is because the field is a captcha field and if the validation on other field fails, page will be rendered with a new captcha code and I want the input field to be empty.</p>
  
  <p>the form:</p>
  
  <pre><code>&lt;h:form id="form"&gt;
     &lt;h:inputText id="otherfieldid" required="true"
          requiredMessage="Please enter"
          validator="#{bean.validateA}"
          validatorMessage="Validation fails" /&gt;
  
      &lt;h:inputText id="fieldid" required="true"
          requiredMessage="Please enter"
          validator="#{bean.validateB}"
          validatorMessage="Validation fails" /&gt;
  &lt;/h:form&gt;
  </code></pre>
  
  <p>Bean:</p>
  
  <pre><code>@ManagedBean
  @ViewScoped
  public Bean {
      public void validateA(FacesContext context,
                  UIComponent componentToValidate,
                  Object value)
                  throws ValidatorException {
          /* validation codes */
      }
  
      public void validateB(FacesContext context,
                  UIComponent componentToValidate,
                  Object value)
                  throws ValidatorException {
  
          HtmlInputText ht = 
              (HtmlInputText) context.getViewRoot().findComponent(":form:otherfieldid");
  
          if (ht != null) {           
              if (ht.getValidatorMessage() != null 
                      || !"".equals(ht.getValidatorMessage())) {              
                  ((HtmlInputText) componentToValidate).setSubmittedValue("");
                  return;
              }
          }
          /* validation codes */
      }
  }
  </code></pre>