Constructors
| Name | Type | Description |
|---|---|---|
type |
string |
the type of the form field |
Methods
-
addStyleClass(styleClass){otris.gadget.gui.Element}
-
Adds a css class to the form field
Name Type Description styleClassstring the style class to be added
Returns:
Type Description otris.gadget.gui.Element current instance for chaining methods -
getAttribute(name){string}
-
Finds and returns the value of a given attribute
Name Type Description namestring the name of the attribute to look for/ return its value
Returns:
Type Description string the value of the given attribute or "" in case the attribute was not found/ empty -
setAttribute(name, value){otris.gadget.gui.Element}
-
Replace or set an attribute
Name Type Description namestring the name of the attribute to replace/ set
valuestring the value to set
Returns:
Type Description otris.gadget.gui.Element current instance for chaining methods -
setEvent(event, handler){otris.gadget.gui.Element}
-
Adds an event handler
Name Type Description eventstring name of the event (e.g.
change)handlerstring the name of the client function (e.g.
myOnchangeFunction)Returns:
Type Description otris.gadget.gui.Element current instance for chaining methods -
setInLine(inLine){otris.gadget.gui.Element}
-
Sets wether or not the form field should be displayed in one line with the previous form field
Name Type Description inLineboolean in same line as previous?
- Default Value:
- false
Returns:
Type Description otris.gadget.gui.Element current instance for chaining methods -
setLabel(label){otris.gadget.gui.Element}
-
Sets the label of the form field
Name Type Description labelstring the new label
Returns:
Type Description otris.gadget.gui.Element current instance for chaining methods -
setMandatory(mandatory){otris.gadget.gui.Element}
-
Sets wether or not the form field will be required to submit the form
Name Type Description mandatoryboolean is the field mandatory?
- Default Value:
- false
Returns:
Type Description otris.gadget.gui.Element current instance for chaining methods -
setReadonly(readonly){otris.gadget.gui.Element}
-
Sets wether or not the form field will readonly
Name Type Description readonlyboolean is the field readonly?
- Default Value:
- false
Returns:
Type Description otris.gadget.gui.Element current instance for chaining methods -
setStyle(name, value){otris.gadget.gui.Element}
-
Set a style attribute of the form field
Name Type Description namestring the name of the style parameter (e.g.
height)valuestring the value of the style parameter (e.g.
100px)Returns:
Type Description otris.gadget.gui.Element current instance for chaining methods -
setValidator(validator)
-
Applies a validator to the input element
A validatorFunction is used to validate the content of the input element
The form can only be submitted if all validators are successfulName Type Description validatorfunction function to validate an input field
validatorFunction(field, gadgetForm, options){validationResult}
The validator function
The field object contains a single field if this validator function is used by otris.gadget.gui.Element#setValidator
The field object contains multiple fields if this validator function is used by otris.gadget.gui.Form#setFormValidatorName Type Description fieldField | object single input field information or object containing mutliple field informations
gadgetFormGadgetForm reference to the GadgetForm
optionsobject options
Name Type Description documentsContextdocuments.sdk.DocumentsContext reference to the documents.sdk.DocumentsContext
Returns:
Type Description validationResult - validation result should be generated via GadgetForm
Example
//validates whether the element value is equal to "otris" element.setValidator(function validateEqualsOtris(field, gadgetForm, options){ var successful = field.value === "otris"; return gadgetForm.createFormValidatorResult(successful, "This value has to equal 'otris'"); }); -
setValue(value){otris.gadget.gui.Element}
-
Sets the value of the element dependend on the element type
Name Type Description valuestring value of the element
Returns:
Type Description otris.gadget.gui.Element current instance for chaining methods -
setWidth(width){otris.gadget.gui.Element}
-
Sets the width of the form field
Name Type Description widthnumber the width (in Pixels) of the form field
Returns:
Type Description otris.gadget.gui.Element current instance for chaining methods