|
Jala 1.3 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object | +--jala.Form
A class that renders forms, validates submitted form data and
stores the data in a specified object.
Defined in Form.js
Nested Class Summary | |
<static class> |
jala.Form.Component |
<static class> |
jala.Form.Tracker |
Field Summary | |
Skin |
componentSkin
Contains the default component skin |
String |
name
Readonly reference to the name of the form |
<static> <final> String |
CHECKOPTIONS
Constant used by require function to define that a select or radio component should validate only if the user input is contained in the list of options provided. |
<static> <final> String |
CONTENTTYPE
Constant used by require function to define that a file upload component should validate only if the file's content type is in the list of allowed content types provided. |
<static> helma.Html |
html
The HTML renderer used by jala.Form |
<static> <final> String |
MAXHEIGHT
Constant used by require function to define that an image upload component should validate only if the image's height is less than the value provided. |
<static> <final> String |
MAXLENGTH
Constant used by require function to define that a component should not validate if userinput exceeds a maximum length. |
<static> <final> String |
MAXWIDTH
Constant used by require function to define that an image upload component should validate only if the image's width is less than the value provided. |
<static> <final> String |
MINHEIGHT
Constant used by require function to define that an image upload component should validate only if the image's height is more than the value provided. |
<static> <final> String |
MINLENGTH
Constant used by require function to define that a component should not validate if userinput is shorter than a given length. |
<static> <final> String |
MINWIDTH
Constant used by require function to define that an image upload component should validate only if the image's width is more than the value provided. |
<static> <final> String |
REQUIRE
Constant used by require function to define that a component should validate only if the user did provide input. |
Constructor Summary | |
jala.Form
(<String> name, <Object> dataObj)
Constructs a new Form instance |
Method Summary | |
void
|
addComponent(<jala.Form.Component.Input> component)
Adds a component to this jala.Form instance |
String
|
class_macro()
Returns the class name of the form |
void
|
close_macro()
Writes the form closing tag to response |
Boolean
|
containsFileUpload()
Returns true if this instance of jala.Form contains at least one component doing a file upload. |
Number
|
countErrors()
If this instance of jala.Form holds a jala.Form.Tracker instance it returns the number of components that didn't validate. |
String
|
createDomId()
Creates a DOM identifier based on the arguments passed. |
String
|
getClassName()
Returns the class name set for this form instance. |
Object
|
getDataObject()
Returns the data object containing the values used for rendering the form. |
String
|
getErrorMessage()
Returns the general error message printed above the form if any of the components didn't validate. |
jala.Form.Tracker
|
getTracker()
Returns the tracker object this form instance uses for collecting error messages and parsed values. |
Boolean
|
handle(<Object> reqData, <Object> destObj)
Parses form input, applies check functions and stores the values if the form does validate. |
Boolean
|
hasError()
Returns true if this instance of jala.Form holds a jala.Form.Tracker instance and at least one error has been set on this tracker. |
String
|
id_macro()
Returns the id (equal to the name) of the form |
Array
|
listComponents()
Returns an array containing the components of this jala.Form instance. |
String
|
name_macro()
Returns the name (equal to the id) of the form |
void
|
open_macro()
Writes the form opening tag to response |
void
|
render()
Renders this form including all components to response. |
void
|
render_macro()
Renders the whole form to response |
String
|
renderAsString(param)
renders the form as a string |
void
|
save(<jala.Form.Tracker> tracker, <Object> destObj)
Sets the parsed values on an object. |
void
|
setClassName(<String> newClassName)
Sets an extra classname for this form instance |
void
|
setDataObject(newDataObj)
Sets the data object which is being edited by this form. |
void
|
setErrorMessage(<String> newErrorMessage)
Sets the general error message printed above the form if any of the components didn't validate. |
void
|
setTracker(<jala.Form.Tracker> newTracker)
Sets the tracker object this form instance uses for collecting error messages and parsed values. |
jala.Form.Tracker
|
validate(<Object> reqData)
Validates user input from a submitted form by calling each component's validate method. |
<static> jala.Form
|
create(<Object> config, dataObj)
Parses a plain javascript object tree and configures a new jala.Form instance according to the properties. |
<static> void
|
extend(<Function> subClass, <Function> superClass)
Utility to set up the prototype, constructor, superclass and superconstructor properties to support an inheritance strategy that can chain constructors and methods. |
<static> String
|
isEmail(<String> name, <String> value, <Object> reqData, <jala.Form> formObj)
Static validator function to test values for being a valid email address. |
<static> String
|
isUrl(<String> name, <String> value, <Object> reqData, <jala.Form> formObj)
Static validator function to test values for being a valid url. |
<static> Object
|
propertyGetter(<String> name, value)
static default getter function used to return a field from the data object. |
<static> void
|
propertySetter(<String> name, <Object> value)
static default setter function used to change a field of the data object. |
Field Detail |
Skin componentSkin
String name
<static> <final> String CHECKOPTIONS
<static> <final> String CONTENTTYPE
<static> helma.Html html
<static> <final> String MAXHEIGHT
<static> <final> String MAXLENGTH
<static> <final> String MAXWIDTH
<static> <final> String MINHEIGHT
<static> <final> String MINLENGTH
<static> <final> String MINWIDTH
<static> <final> String REQUIRE
Constructor Detail |
jala.Form(<String> name, <Object> dataObj)
name
- The name of the form
dataObj
- An optional object used to retrieve values to display in the form input fields contained in this Form instance.
Method Detail |
void addComponent(<jala.Form.Component.Input> component)
component
-
String class_macro()
void close_macro()
Boolean containsFileUpload()
Number countErrors()
String createDomId()
String getClassName()
Object getDataObject()
String getErrorMessage()
jala.Form.Tracker getTracker()
Boolean handle(<Object> reqData, <Object> destObj)
reqData
- input from form
destObj
- object whose values should be chanegd
Boolean hasError()
String id_macro()
Array listComponents()
String name_macro()
void open_macro()
void render()
void render_macro()
String renderAsString(param)
void save(<jala.Form.Tracker> tracker, <Object> destObj)
tracker
- (optional) tracker object holding parsed data from form input.
destObj
- (optional) object whose values will be changed. By default the dataObj passed to the constructor or to setDataObject is used.
void setClassName(<String> newClassName)
newClassName
- new classname
void setDataObject(newDataObj)
dataObj
- The object which is being edited by this form.
void setErrorMessage(<String> newErrorMessage)
newErrorMessage
- error message
void setTracker(<jala.Form.Tracker> newTracker)
newTracker
-
jala.Form.Tracker validate(<Object> reqData)
reqData
- Optional submitted form data. If not specified req.data is used.
<static> jala.Form create(<Object> config, dataObj)
config
- object tree containing config
<static> void extend(<Function> subClass, <Function> superClass)
subClass
- the object which inherits superClass' functions
superClass
- the object to inherit
<static> String isEmail(<String> name, <String> value, <Object> reqData, <jala.Form> formObj)
name
- name of the property being validated.
value
- value in form input
reqData
- the whole request-data-object, in case properties depend on each other
formObj
- instance of jala.Form
<static> String isUrl(<String> name, <String> value, <Object> reqData, <jala.Form> formObj)
name
- name of the property being validated.
value
- value in form input
reqData
- the whole request-data-object, in case properties depend on each other
formObj
- instance of jala.Form
<static> Object propertyGetter(<String> name, value)
name
- Name of the property.
<static> void propertySetter(<String> name, <Object> value)
name
- Name of the property.
value
- New value of the property.
|
Jala 1.3 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |