fc.web.forms
Class VSelectValue

java.lang.Object
  extended by fc.web.forms.FieldValidator
      extended by fc.web.forms.VSelectValue

public final class VSelectValue
extends FieldValidator

Validates that a select field has:

  1. some value(s)
  2. the values(s) are not a pre-specified value.
This is useful to see if the select field (popup) was selected by the user (typically, select fields may be displayed with a dummy default ---choose an option--- type selection. In that case, we would check to see if the select value was not ---choose an option---.


Constructor Summary
VSelectValue(Select field, String errorMessage, String badSelectValue)
           
 
Method Summary
 boolean validate(FormData fd, javax.servlet.http.HttpServletRequest req)
          Works with the Select field.
 
Methods inherited from class fc.web.forms.FieldValidator
getErrorMessage, getField
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VSelectValue

public VSelectValue(Select field,
                    String errorMessage,
                    String badSelectValue)
Parameters:
field - the parent field
badSelectValue - the select value which will cause the validation to fail
errorMessage - error message for unsuccessful validation error.
Method Detail

validate

public boolean validate(FormData fd,
                        javax.servlet.http.HttpServletRequest req)
Works with the Select field.

Specified by:
validate in class FieldValidator
Throws:
ClassCastException - If the field's Field#getValue method does not return a collection of Select.Option objects