Detailed reference of prototypes, properties and methods available in the
Javascript environment of your Helma web applications.

This class can be used to render forms and to validate and store user submits. Further types of form components can be added by subclassing jala.Form.Component.Input.
jala Form(name, dataObj)
Constructs a new Form instance
parameters
String name The name of the form
Object dataObj An optional object used to retrieve values to display in the form input fields contained in this Form instance.
methods
  • save(tracker, destObj)
properties
jala Form.Component(name)
The abstract base class for all components.
parameters
name
methods
  • save(destObj, val)
jala Form.Component.Fieldset(name)
Constructs a new Fieldset instance
parameters
String name The name of the fieldset
methods
  • save(tracker, destObj)
properties
jala Form.Component.Skin(name)
Subclass of jala.Form.Component that allows rendering a skin within a form.
parameters
String name The name of the component, used as the name of the skin
methods
jala Form.Component.Input(name)
Creates a new input component instance.
parameters
String name Name of the component, used as name of the html control.
methods
  • save(tracker, destObj)
jala Form.Component.Password(name)
Constructs a newly created Password component instance
parameters
String name Name of the component, used as name of the html controls.
methods
jala Form.Component.Hidden(name)
Constructs a newly created Hidden component instance
parameters
String name Name of the component, used as name of the html controls.
methods
jala Form.Component.Textarea(name)
Constructs a new Textarea component.
parameters
String name Name of the component, used as name of the html controls.
methods
jala Form.Component.Date(name)
Constructs a new Date component instance
parameters
String name Name of the component, used as name of the html controls.
methods
jala Form.Component.Select(name)
Constructs a new Select component instance
parameters
String name Name of the component, used as name of the html controls.
methods
jala Form.Component.Radio(name)
Creates a new Radio component instance
parameters
String name Name of the component, used as name of the html controls.
methods
jala Form.Component.Checkbox(name)
Creates a new Checkbox component instance
parameters
String name Name of the component, used as name of the html controls.
methods
jala Form.Component.File(name)
Creates a new File component instance
parameters
String name Name of the component, used as name of the html controls.
methods
jala Form.Component.Image(name)
Creates a new Image component instance
parameters
String name Name of the component, used as name of the html controls.
methods
jala Form.Component.Button(name)
Creates a new Button component instance
parameters
String name Name of the component, used as name of the html controls.
methods
  • render(attr, value, reqData)
jala Form.Component.Submit(name)
Creates a new Submit component instance
parameters
String name Name of the component, used as name of the html controls.
methods
jala Form.Tracker(reqData)
A generic container for error-messages and values
parameters
reqData
methods
properties
String jala.Form. name
Readonly reference to the name of the form
Skin jala.Form. componentSkin
Contains the default component skin
Object jala.Form. components
Contains a map of component objects.
helma.Html jala. Form.html
The HTML renderer used by jala.Form
String jala. Form.MINLENGTH
Constant used by require function to define that a component should not validate if userinput is shorter than a given length. Value: "minlength"
String jala. Form.MAXLENGTH
Constant used by require function to define that a component should not validate if userinput exceeds a maximum length. Value: "maxlength"
String jala. Form.REQUIRE
Constant used by require function to define that a component should validate only if the user did provide input. Value: "require"
String jala. Form.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. Value: "checkoptions"
String jala. Form.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. Value: "contenttype"
String jala. Form.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. Value: "maxwidth"
String jala. Form.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. Value: "minwidth"
String jala. Form.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. Value: "maxheight"
String jala. Form.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. Value: "min-height"
Contains a map of all component objects of this fieldset
Object jala.Form.Tracker. reqData
A map containing input from request data
Object jala.Form.Tracker. values
A map containing parsed values (only for those fields that didn't fail during checkRequirements method).
Object jala.Form.Tracker. errors
A map containing error messages
Methods
jala.Form. setDataObject(dataObj)
Sets the data object which is being edited by this form. This object is used to get the default values when first printing the form and - if no other object is provided - receives the changed values in save.
parameters
Object dataObj The object which is being edited by this form.
see
jala.Form. getDataObject()
Returns the data object containing the values used for rendering the form.
returns
The data object of this jala.Form instance
jala.Form. setTracker(newTracker)
Sets the tracker object this form instance uses for collecting error messages and parsed values.
parameters
jala.Form.Tracker newTracker
jala.Form. getTracker()
Returns the tracker object this form instance uses for collecting error messages and parsed values.
returns
tracker object
jala.Form. listComponents()
Returns an array containing the components of this jala.Form instance.
returns
The components of this jala.Form instance.
jala.Form. addComponent(component)
Adds a component to this jala.Form instance
parameters
jala.Form.Component.Input component
jala.Form. containsFileUpload()
Returns true if this instance of jala.Form contains at least one component doing a file upload.
see
jala.Form. getClassName()
Returns the class name set for this form instance.
returns
class name
jala.Form. setClassName(newClassName)
Sets an extra classname for this form instance
parameters
String newClassName new classname
jala.Form. getErrorMessage()
Returns the general error message printed above the form if any of the components didn't validate.
returns
error message
jala.Form. setErrorMessage(newErrorMessage)
Sets the general error message printed above the form if any of the components didn't validate.
parameters
String newErrorMessage error message
jala.Form. 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.
returns
true if an error has been encountered.
jala.Form. countErrors()
If this instance of jala.Form holds a jala.Form.Tracker instance it returns the number of components that didn't validate.
returns
Number of components that didn't validate.
jala. Form.extend(subClass, superClass)
Utility to set up the prototype, constructor, superclass and superconstructor properties to support an inheritance strategy that can chain constructors and methods.
parameters
Function subClass the object which inherits superClass' functions
Function superClass the object to inherit
jala. Form.create(config)
Parses a plain javascript object tree and configures a new jala.Form instance according to the properties. Propertynames are matched with constants and setter-functions, the property "type" is used to create new component objects.
parameters
Object config object tree containing config
returns
A newly created jala.Form instance based on the config specified
jala. Form.isEmail(name, value, reqData, formObj)
Static validator function to test values for being a valid email address.
parameters
String name name of the property being validated.
String value value in form input
Object reqData the whole request-data-object, in case properties depend on each other
jala.Form formObj instance of jala.Form
returns
Error message or null
jala. Form.isUrl(name, value, reqData, formObj)
Static validator function to test values for being a valid url.
parameters
String name name of the property being validated.
String value value in form input
Object reqData the whole request-data-object, in case properties depend on each other
jala.Form formObj instance of jala.Form
returns
Error message or null
jala.Form. render()
Renders this form including all components to response.
jala.Form. renderAsString(param)
renders the form as a string
parameters
param
returns
rendered form
jala.Form. createDomId()
Creates a DOM identifier based on the arguments passed. The resulting Id will be prefixed with the name of the form. All arguments will be chained using camel casing.
returns
The DOM Id
jala.Form. validate(reqData)
Validates user input from a submitted form by calling each component's validate method.
parameters
Object reqData Optional submitted form data. If not specified req.data is used.
returns
tracker object with error fields set.
jala.Form. save(tracker, destObj)
Sets the parsed values on an object. By default the internally stored tracker and data objects are used, but those may be overridden here.
parameters
jala.Form.Tracker tracker (optional) tracker object holding parsed data from form input.
Object destObj (optional) object whose values will be changed. By default the dataObj passed to the constructor or to setDataObject is used.
jala.Form. handle(reqData, destObj)
Parses form input, applies check functions and stores the values if the form does validate. Otherwise this method returns false without saving so that the form can be reprinted with error messages.
parameters
Object reqData input from form
Object destObj object whose values should be chanegd
returns
False if one of the checks failed, true if the element was saved correctly.
jala.Form. render_macro()
Renders the whole form to response
jala.Form. id_macro()
Returns the id (equal to the name) of the form
returns
The id of this Form instance
jala.Form. name_macro()
Returns the name (equal to the id) of the form
returns
The name of this Form instance
jala.Form. class_macro()
Returns the class name of the form
returns
The class name of this Form instance
jala.Form. open_macro()
Writes the form opening tag to response