|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sas.Component | +--com.sas.servlet.beans.BaseTransformation | +--com.sas.servlet.beans.html.Form
Convenience Object for creating HTML forms. A form can also perform client-side validations (via JavaScript) such as:
Field Summary | |
static String |
DEFAULT_ENCODE_TYPE
|
static String |
DEFAULT_METHOD
|
static String |
DEFAULT_VALIDATION_FUNCTION_NAME
|
static String |
RB_KEY
|
Constructor Summary | |
Form()
Construct a new Form object |
|
Form(String name)
Construct a new Form object |
Method Summary | |
protected int |
findBeanIndex(TransformationInterface bean)
Finds the validation index of the given bean |
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. |
protected boolean |
isValidationNecessary(int type)
Determines if a given validation type is necessary |
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 |
write(PrintWriter out)
Writes the transformed representation of the object |
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 |
protected boolean |
writeValidations(PrintWriter out)
Writes the validation routines |
Methods inherited from class com.sas.servlet.beans.BaseTransformation |
getCustomAttributes,
getDescription,
getName,
getParent,
getRequest,
getResponse,
setCustomAttributes,
setDescription,
setName,
setParent,
setRequest,
setResponse,
toString,
write,
write,
write |
Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static final String DEFAULT_METHOD
public static final String DEFAULT_ENCODE_TYPE
public static final String DEFAULT_VALIDATION_FUNCTION_NAME
public static final String RB_KEY
Constructor Detail |
public Form()
public Form(String name)
name
- The name of the formMethod Detail |
public void setMethod(String method)
method
- The HTTP methodpublic String getMethod()
public void setAction(String action)
action
- The action URLpublic String getAction()
public void setEncodeType(String enctype)
enctype
- The encode typepublic String getEncodeType()
public void setValidationFunctionName(String name)
name
- The validation function namepublic String getValidationFunctionName()
public void setOnSubmitFunctionName(String name)
name
- The onSubmit function namepublic String getOnSubmitFunctionName()
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:
or numeric-only:
or both:
transformationBean
- The input field to validatetype
- The type of validationpublic 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 the minimum numeric value:
validate the minimum numeric value:
transformationBean
- The input field to validatetype
- The type of validationarg
- The validation type specific argumentprotected int findBeanIndex(TransformationInterface bean)
bean
- The transformation beanpublic void write(PrintWriter out) throws IOException
out
- The output streampublic void writeHeader(PrintWriter out) throws IOException
out
- The output streamprotected boolean writeValidations(PrintWriter out) throws IOException
out
- The output streamprotected boolean isValidationNecessary(int type)
type
- The validation typepublic void writeHeader(Writer out) throws IOException
out
- The output streampublic void writeHeader(OutputStream out) throws IOException
out
- The output streampublic void writeFooter(PrintWriter out) throws IOException
out
- The output streampublic void writeFooter(Writer out) throws IOException
out
- The output streampublic void writeFooter(OutputStream out) throws IOException
out
- The output stream
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |