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 styleClass
string 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 name
string 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 name
string the name of the attribute to replace/ set
value
string 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 event
string name of the event (e.g.
change
)handler
string 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 inLine
boolean 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 label
string 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 mandatory
boolean 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 readonly
boolean 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 name
string the name of the style parameter (e.g.
height
)value
string 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 validator
function 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 field
Field | object single input field information or object containing mutliple field informations
gadgetForm
GadgetForm reference to the GadgetForm
options
object options
Name Type Description documentsContext
documents.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 value
string 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 width
number the width (in Pixels) of the form field
Returns:
Type Description otris.gadget.gui.Element current instance for chaining methods