com.sas.servlet.beans.html
Interface FormInterface

All Known Implementing Classes:
Form

public interface FormInterface
extends TransformationInterface

Convenience interface for creating HTML forms. A form can also perform client-side validations (via JavaScript) such as:

  • Required fields
  • Numeric input
  • Valid dates
  • Maximum lengths
  • Minimum/Maximum values

  • Field Summary
    static int VALIDATE_MAXLENGTH
              Flag used to ensure that the field does not exceed a maximum length when validating.
    static int VALIDATE_MAXVALUE
              Flag used to ensure that the field contains only numeric values and is less than, or equal to, a maximum value.
    static int VALIDATE_MINVALUE
              Flag used to ensure that the field contains only numeric values and is greater than, or equal to, a minimum value.
    static int VALIDATE_NONE
              Flag used to clear the validation for the field
    static int VALIDATE_NUMERIC
              Flag used to ensure that the field contains only numeric values when validating.
    static int VALIDATE_REQUIRED
              Flag used to ensure that the field is non-blank when validating.
     
    Method Summary
     String getAction()
              Gets the URL which is used to post forms
     String getEncodeType()
              Gets the mechanism used to encode the form's content.
     String getMethod()
              Gets the HTTP method to be used when sending the form contents to the server.
     String getOnSubmitFunctionName()
              Returns the name of the function to call when the form is submitted
     String getValidationFunctionName()
              Gets the name of the validation function.
     void setAction(String action)
              Sets the URL which is used to post forms via email (i.e "mailto:some.one@sas.com") or a server-side form handler (such as a servlet or JSP page) via HTTP (i.e.
     void setEncodeType(String enctype)
              Sets the mechanism used to encode the form's content.
     void setMethod(String method)
              Sets the HTTP method to be used when sending the form contents to the server.
     void setOnSubmitFunctionName(String name)
              Sets the name of the function to call when the form is submitted.
     void setValidationFunctionName(String name)
              Sets the name of the validation function to create if there are input fields associated with the form (via the validate methods).
     void validate(TransformationInterface bean, int type)
              Register a transformation bean to be validated before the form is submitted.
     void validate(TransformationInterface bean, int type, Object arg)
              Register a transformation bean to be validated before the form is submitted.
     void writeFooter(OutputStream out)
              Writes the form footer
     void writeFooter(PrintWriter out)
              Writes the form footer
     void writeFooter(Writer out)
              Writes the form footer
     void writeHeader(OutputStream out)
              Writes the form header
     void writeHeader(PrintWriter out)
              Writes the form header
     void writeHeader(Writer out)
              Writes the form header
     
    Methods inherited from interface com.sas.servlet.beans.TransformationInterface
    getCustomAttributes, getDescription, getName, getParent, getRequest, getResponse, setCustomAttributes, setDescription, setName, setParent, setRequest, setResponse, write, write, write, write
     
    Methods inherited from interface com.sas.ComponentInterface
    addPropertyChangeListener, addVetoableChangeListener, anyPropertyChangeListeners, dumpComponent, firePropertyChange, firePropertyChange, fireVetoableChange, getComponentDescription, getComponentSupportInfo, initialize, initializeComponent, isDesignTime, removePropertyChangeListener, removeVetoableChangeListener, setComponentDescription, setComponentSupportInfo, setDefaultValues
     
    Methods inherited from interface com.sas.ViewInterface
    attachModel, detachModel, getModelInterface, getRequiredInterfaces, getViewInterfaceSupportInfo, refresh, removeInterfaceTraps, setModelInterface, setRequiredInterfaces, setViewInterfaceSupportInfo, supportsRequiredInterfaces, trapInterfaceEvents
     
    Methods inherited from interface com.sas.ModelInterface
    attachView, detachView
     
    Methods inherited from interface com.sas.LinkPropertiesInterface
    addLink, getLinkInfo, isLinked, queryLinks, queryLinks, removeAllLinks, removeLink, setLinkInfo
     
    Methods inherited from interface java.beans.PropertyChangeListener
    propertyChange
     
    Methods inherited from interface java.io.ObjectInputValidation
    validateObject
     

    Field Detail

    VALIDATE_NONE

    public static final int VALIDATE_NONE
    Flag used to clear the validation for the field

    VALIDATE_REQUIRED

    public static final int VALIDATE_REQUIRED
    Flag used to ensure that the field is non-blank when validating.

    VALIDATE_NUMERIC

    public static final int VALIDATE_NUMERIC
    Flag used to ensure that the field contains only numeric values when validating.

    VALIDATE_MAXLENGTH

    public static final int VALIDATE_MAXLENGTH
    Flag used to ensure that the field does not exceed a maximum length when validating.

    VALIDATE_MINVALUE

    public static final int VALIDATE_MINVALUE
    Flag used to ensure that the field contains only numeric values and is greater than, or equal to, a minimum value.

    VALIDATE_MAXVALUE

    public static final int VALIDATE_MAXVALUE
    Flag used to ensure that the field contains only numeric values and is less than, or equal to, a maximum value.
    Method Detail

    setMethod

    public void setMethod(String method)
    Sets the HTTP method to be used when sending the form contents to the server. Valid values are "GET" and "POST". The default value is "GET"
    Parameters:
    method - The HTTP method

    getMethod

    public String getMethod()
    Gets the HTTP method to be used when sending the form contents to the server.
    Returns:
    The HTTP method

    setAction

    public void setAction(String action)
    Sets the URL which is used to post forms via email (i.e "mailto:some.one@sas.com") or a server-side form handler (such as a servlet or JSP page) via HTTP (i.e. "http://www.sas.com/jsp/my.jsp").
    Parameters:
    action - The action URL

    getAction

    public String getAction()
    Gets the URL which is used to post forms
    Returns:
    The action URL

    setEncodeType

    public void setEncodeType(String enctype)
    Sets the mechanism used to encode the form's content. The default is "application/x-www-form-urlencoded"
    Parameters:
    enctype - The encode type

    getEncodeType

    public String getEncodeType()
    Gets the mechanism used to encode the form's content.
    Returns:
    The encode type

    setValidationFunctionName

    public void setValidationFunctionName(String name)
    Sets the name of the validation function to create if there are input fields associated with the form (via the validate methods). The default is OnSubmit.
    Parameters:
    name - The validation function name

    getValidationFunctionName

    public String getValidationFunctionName()
    Gets the name of the validation function.
    Returns:
    The validation function name

    setOnSubmitFunctionName

    public void setOnSubmitFunctionName(String name)
    Sets the name of the function to call when the form is submitted. The default is OnSubmit. If the user wants to add additional validation code for the form the OnSubmitFunctionName can be set to a custom validation routine. The custom validation routine can invoke the standard validation function generated by this bean and, in turn, perform additional validation.
    Parameters:
    name - The onSubmit function name

    getOnSubmitFunctionName

    public String getOnSubmitFunctionName()
    Returns the name of the function to call when the form is submitted
    Returns:
    The onSubmit function name

    validate

    public void validate(TransformationInterface bean,
                         int type)

    Register a transformation bean to be validated before the form is submitted. A JavaScript function will be generated to perform the validation.

    For example, a Text Transformation Bean can be validated to be non-blank:

    validate(textBean, FormInterface.VALIDATE_REQUIRED);

    or numeric-only:

    validate(textBean, FormInterface.VALIDATE_NUMERIC);

    or both:

    validate(textBean, FormInterface.VALIDATE_REQUIRED | FormInterface.VALIDATE_NUMERIC);
    Parameters:
    transformationBean - The input field to validate
    type - The type of validation

    validate

    public void validate(TransformationInterface bean,
                         int type,
                         Object arg)

    Register a transformation bean to be validated before the form is submitted. This method takes an additional validation type specific argument

    For example, a Text Transformation Bean can be validated to have a maximum length:

    validate(textBean, FormInterface.VALIDATE_MAXLENGTH, new Double(20));

    validate the minimum numeric value:

    validate(textBean, FormInterface.VALIDATE_MINVALUE, new Double(0));

    validate the minimum numeric value:

    validate(textBean, FormInterface.VALIDATE_MAXVALUE, new Double(100));
    Parameters:
    transformationBean - The input field to validate
    type - The type of validation
    arg - The validation type specific argument

    writeHeader

    public void writeHeader(PrintWriter out)
                     throws IOException
    Writes the form header
    Parameters:
    out - The output stream
    Throws:
    IOException - Thrown if some type of I/O error occurs

    writeHeader

    public void writeHeader(Writer out)
                     throws IOException
    Writes the form header
    Parameters:
    out - The output stream
    Throws:
    IOException - Thrown if some type of I/O error occurs

    writeHeader

    public void writeHeader(OutputStream out)
                     throws IOException
    Writes the form header
    Parameters:
    out - The output stream
    Throws:
    IOException - Thrown if some type of I/O error occurs

    writeFooter

    public void writeFooter(PrintWriter out)
                     throws IOException
    Writes the form footer
    Parameters:
    out - The output stream
    Throws:
    IOException - Thrown if some type of I/O error occurs

    writeFooter

    public void writeFooter(Writer out)
                     throws IOException
    Writes the form footer
    Parameters:
    out - The output stream
    Throws:
    IOException - Thrown if some type of I/O error occurs

    writeFooter

    public void writeFooter(OutputStream out)
                     throws IOException
    Writes the form footer
    Parameters:
    out - The output stream
    Throws:
    IOException - Thrown if some type of I/O error occurs


    Version: 1.2.20000317.001 Formatted: 2000/07/06 15:57:33PM