Class jabberwerx.XDataFormField
Extends
jabberwerx.JWModel.
Holds collection of properties for data form field.
Constructor Attributes | Constructor Name and Description |
---|---|
jabberwerx.XDataFormField(varName, values, fieldNode)
Creates a new XDataFormField with the given DOM element or given var name and values. |
Method Attributes | Method Name and Description |
---|---|
destroy()
Destroys this data form. |
|
equals(field)
Determines if the given field matches this field. |
|
getDesc()
Gets the desciption for the field element. |
|
getDOM(form)
Gets the DOM of the field element. |
|
getLabel()
Gets the label for the field element. |
|
Gets options for the field element. |
|
Gets the "required" flag for the field element. |
|
getType()
Gets the type for the field element. |
|
Gets value(s) for the field element. |
|
getVar()
Gets the var name for the field element. |
|
setDesc(desc)
Sets the desciption for the field element. |
|
setLabel(label)
Sets the label for the field element. |
|
setOptions(options)
Sets options for the field element. |
|
setRequired(required)
Sets the "required" flag for the field element. |
|
setType(type)
Sets the type for the field element. |
|
setValues(values)
Sets values for the field element. |
|
setVar(var_name)
Sets the var name for the field element. |
|
validate()
Performs validation for XDataField. |
- Methods borrowed from class jabberwerx.JWModel:
- applyEvent, event, shouldBeSavedWithGraph
- Methods borrowed from class jabberwerx.JWBase:
- getClassName, graphUnserialized, init, invocation, shouldBeSerializedInline, toString, wasUnserialized, willBeSerialized
Creates a new XDataFormField with the given DOM element or given var name and values.
- Parameters:
- {String} varName Optional
- Represents field id.
- {String} values Optional
- Field value
- {Element} fieldNode Optional
- The DOM element representing the field node.
- Throws:
- {TypeError}
- if any of the parameters are not valid
Destroys this data form.
Determines if the given field matches this field. This method returns true if all properties of this field are equal to {fields}'s.
- Parameters:
- {jabberwerx.XDataFormField} field
- The field to match against
- Returns:
- {Boolean} true if {fields}'s properties matches this XDataFormField.
Gets the desciption for the field element.
- Returns:
- {String} Field description
Gets the DOM of the field element.
DOM:<field type='list-multi' label='What features will the bot support?' var='features'> <option label='Contests'><value>contests</value></option> <option label='News'><value>news</value></option> <option label='Polls'><value>polls</value></option> <option label='Reminders'><value>reminders</value></option> <option label='Search'><value>search</value></option> <value>news</value> <value>search</value> </field>
- Parameters:
- {jabberwerx.NodeBuilder} form
- DOM element of the field
Gets the label for the field element.
- Returns:
- {String} Field label
Gets options for the field element.
- Returns:
- {Array} Label/value list, e.g. {'label':'My label','value':'My Value'}
Gets the "required" flag for the field element.
- Returns:
- {Boolean} Indicator for the required field
Gets the type for the field element.
- Returns:
- {String} Field type
Gets value(s) for the field element.
- Returns:
- {Array} Array of field values
Gets the var name for the field element.
- Returns:
- {String} Field var name
Sets the desciption for the field element.
- Parameters:
- {String} desc Optional
- Field description
Sets the label for the field element.
- Parameters:
- {String} label Optional
- Field label
Sets options for the field element.
- Parameters:
- {Array} options Optional
- Label/value list, e.g. {'label':'My label','value':'My Value'}
Sets the "required" flag for the field element.
- Parameters:
- {Boolean} required Optional
- Indicator for the required field
Sets the type for the field element.
- Parameters:
- {String} type Optional
- Field type
Sets values for the field element.
- Parameters:
- {Array|Object} values Optional
- Array of field values or a single value
- Throws:
- {TypeError}
- if {values} is not String, number or Array
Sets the var name for the field element.
- Parameters:
- {String} var_name Optional
- Field var name
Performs validation for XDataField.
- Throws:
- {jabberwerx.XDataFormField.InvalidXDataFieldError}
- If any of the rules for field's values have been violated