PAJES 3.0.21

org.pajes.html.validation
Class IsSelected

java.lang.Object
  extended by org.pajes.html.validation.ValidationFunction
      extended by org.pajes.html.validation.IsSelected
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class IsSelected
extends ValidationFunction

Creates a JavaScript validation function to validate that the user has selected a valid item from a select list.

See Also:
Serialized Form

Constructor Summary
IsSelected()
          Creates a JavaScript validation function.
IsSelected(Select element, java.lang.String displayName)
          Creates a JavaScript validation function.
IsSelected(Select element, java.lang.String displayName, int indexToIgnore)
          Creates a JavaScript validation function.
 
Method Summary
 boolean isMandatory()
          Determines if any entries in the list are to be ignored, and therefore whether or not this field is mandatory.
 void setIgnoreIndex(int indexToIgnore)
          Sets the item in the select list to be ignored when determining if a value has been selected from the list.
 void setIgnoreIndex(java.lang.Integer indexToIgnore)
          Sets the item in the select list to be ignored when determining if a value has been selected from the list.
 void setIgnoreIndex(java.lang.String indexToIgnore)
          Sets the item in the select list to be ignored when determining if a value has been selected from the list.
 ValidationFunction setMandatory(boolean valueIsRequired)
          Sets validation to ensure the user enters a value in this field.
 java.lang.String toJavaScript(Browser browser)
          Converts the validation function into a string to be returned to the browser.
 
Methods inherited from class org.pajes.html.validation.ValidationFunction
clone, getDisplayName, getInputField, setDisplayName, setInputField, setMandatory, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IsSelected

public IsSelected()
Creates a JavaScript validation function.


IsSelected

public IsSelected(Select element,
                  java.lang.String displayName)
Creates a JavaScript validation function.

Parameters:
element - the select list to be validated.
displayName - the name of the field that will appear in any error messages.

IsSelected

public IsSelected(Select element,
                  java.lang.String displayName,
                  int indexToIgnore)
Creates a JavaScript validation function.

Parameters:
element - the select list to be validated.
displayName - the name of the field that will appear in any error messages.
indexToIgnore - a zero-indexed item in the select list to be ignored when determining if a value has been selected from the list.
Method Detail

isMandatory

public boolean isMandatory()
Determines if any entries in the list are to be ignored, and therefore whether or not this field is mandatory.

Overrides:
isMandatory in class ValidationFunction
Returns:
true if this field is mandatory, or false if it is not.

setIgnoreIndex

public void setIgnoreIndex(int indexToIgnore)
Sets the item in the select list to be ignored when determining if a value has been selected from the list.

Parameters:
indexToIgnore - a zero-indexed item in the select list to be ignored when determining if a value has been selected from the list.

setIgnoreIndex

public void setIgnoreIndex(java.lang.Integer indexToIgnore)
Sets the item in the select list to be ignored when determining if a value has been selected from the list.

Parameters:
indexToIgnore - a zero-indexed item in the select list to be ignored when determining if a value has been selected from the list.

setIgnoreIndex

public void setIgnoreIndex(java.lang.String indexToIgnore)
Sets the item in the select list to be ignored when determining if a value has been selected from the list.

Parameters:
indexToIgnore - a zero-indexed item in the select list to be ignored when determining if a value has been selected from the list.

setMandatory

public ValidationFunction setMandatory(boolean valueIsRequired)
Sets validation to ensure the user enters a value in this field.

Overrides:
setMandatory in class ValidationFunction
Parameters:
valueIsRequired - true if a value is mandatory.
Returns:
the modified ValidationFunction object.

toJavaScript

public java.lang.String toJavaScript(Browser browser)
Converts the validation function into a string to be returned to the browser.

Specified by:
toJavaScript in class ValidationFunction
Parameters:
browser - the browser to which the function will be returned.
Returns:
the string consisting of the JavaScript function that will be sent to the browser to validate the input field.

PAJES 3.0.21

Copyright 1998-2007 Viridian Pty Limited. All Rights Reserved.