Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.javahispano.canyamo.util.html.form
Class FormValidator  view FormValidator download FormValidator.java

java.lang.Object
  extended byorg.javahispano.canyamo.util.html.form.FormValidator

public class FormValidator
extends java.lang.Object

Validate and parse an HTML forms. This class has two primary functions:

- First, be sure that all requiered fields are entered
- Second, be sure that entered data follows the given rules


The configuration info is given in a XML file.

TO DO: talk about config-XML's format

Version:
1.0

Field Summary
protected  org.javahispano.canyamo.core.WorkData data
          Description of the Field
protected  java.util.Map fields
          Description of the Field
protected  java.util.List rules
          Description of the Field
protected static java.text.SimpleDateFormat sdf
          Description of the Field
 
Constructor Summary
FormValidator(java.lang.String configFile)
          Constructor for the FormValidator object
 
Method Summary
protected  void addField(java.lang.String name, java.lang.String type)
          Adds a feature to the Field attribute of the FormValidator object
protected  void addRule(FormRule rule)
          Adds a feature to the Rule attribute of the FormValidator object
 java.lang.Object getParameter(org.javahispano.canyamo.core.WorkData data, java.lang.String key)
          Returns an Object of the given type for the given parameter.
protected  void setDateFormat(java.lang.String format)
          Sets the format for date-fields
 void validate(org.javahispano.canyamo.core.WorkData data)
          Validates a posted form following the rules descripted in it's xml config file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sdf

protected static java.text.SimpleDateFormat sdf
Description of the Field


fields

protected java.util.Map fields
Description of the Field


rules

protected java.util.List rules
Description of the Field


data

protected org.javahispano.canyamo.core.WorkData data
Description of the Field

Constructor Detail

FormValidator

public FormValidator(java.lang.String configFile)
Constructor for the FormValidator object

Method Detail

getParameter

public java.lang.Object getParameter(org.javahispano.canyamo.core.WorkData data,
                                     java.lang.String key)
Returns an Object of the given type for the given parameter.


validate

public void validate(org.javahispano.canyamo.core.WorkData data)
              throws FormException
Validates a posted form following the rules descripted in it's xml config file.


setDateFormat

protected void setDateFormat(java.lang.String format)
Sets the format for date-fields


addField

protected void addField(java.lang.String name,
                        java.lang.String type)
Adds a feature to the Field attribute of the FormValidator object


addRule

protected void addRule(FormRule rule)
Adds a feature to the Rule attribute of the FormValidator object