title: Shouldn't the validation be skipped when there is no value specified?
body: <p>I'm using JSF2 on GlassFish 3.</p>
  
  <p>I have a form that accepts and optional phone number.  I have this custom phone number validator (below), and I have the field set to required="false" because the phone number is optional in the form.</p>
  
  <p>The problem is, the value in the field is always getting validated.  Shouldn't the validation be skipped when there is no value specified?</p>
  
  <p>There must be something I'm doing wrong.  Any help is appreciated, thanks!</p>
  
  <pre><code>&lt;h:outputText value="#{msg.profile_otherPhone1Label}#{msg.colon}" /&gt;
    &lt;h:panelGroup&gt;
      &lt;p:inputText label="#{msg.profile_otherPhone1Label}" id="otherPhone1" value="#{profileHandler.profileBean.otherPhone1}" required="false"&gt;
        &lt;f:validator validatorId="phoneValidator" /&gt;
      &lt;/p:inputText&gt;
    &lt;p:spacer width="12"/&gt;
    &lt;h:outputText value="#{msg.profile_phoneExample}" /&gt;
  &lt;/h:panelGroup&gt;
  </code></pre>
  
  <p>#</p>
  
  <pre><code>public class PhoneValidator implements Validator {
  
      @Override
      public void validate(FacesContext facesContext, UIComponent uIComponent,
              Object object) throws ValidatorException {
  
          String phone = (String) object;
  
          // count the digits; must have at least 9 digits to be a valid phone number
          // note: we're not enforcing the format because there can be a lot of variation
          int iDigitCount = 0;
          for (char c : phone.toCharArray()) {
              if (Character.isDigit(c)) {
                  iDigitCount++;
              }
          }
  
          if (iDigitCount &lt; 9) {
              FacesMessage message = new FacesMessage();
              message.setSummary(Messages.getMessage("error_phoneNumberNotValid"));
              message.setSeverity(FacesMessage.SEVERITY_ERROR);
              throw new ValidatorException(message);
          }
      }
  
  }
  </code></pre>