Class Index | Minimal

Classes


Class jabberwerx.XDataFormField


Extends jabberwerx.JWModel.

Holds collection of properties for data form field.

Class Summary
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 Summary
Method Attributes Method Name and Description
 

Destroys this data form.

 
equals(field)

Determines if the given field matches this field.

 

Gets the desciption for the field element.

 
getDOM(form)

Gets the DOM of the field element.

 

Gets the label for the field element.

 

Gets options for the field element.

 

Gets the "required" flag for the field element.

 

Gets the type for the field element.

 

Gets value(s) for the field element.

 

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.

 

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
Class Detail
jabberwerx.XDataFormField(varName, values, fieldNode)

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
Method Detail
destroy()

Destroys this data form.


{Boolean} equals(field)

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.

{String} getDesc()

Gets the desciption for the field element.

Returns:
{String} Field description

getDOM(form)

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

{String} getLabel()

Gets the label for the field element.

Returns:
{String} Field label

{Array} getOptions()

Gets options for the field element.

Returns:
{Array} Label/value list, e.g. {'label':'My label','value':'My Value'}

{Boolean} getRequired()

Gets the "required" flag for the field element.

Returns:
{Boolean} Indicator for the required field

{String} getType()

Gets the type for the field element.

Returns:
{String} Field type

{Array} getValues()

Gets value(s) for the field element.

Returns:
{Array} Array of field values

{String} getVar()

Gets the var name for the field element.

Returns:
{String} Field var name

setDesc(desc)

Sets the desciption for the field element.

Parameters:
{String} desc Optional
Field description

setLabel(label)

Sets the label for the field element.

Parameters:
{String} label Optional
Field label

setOptions(options)

Sets options for the field element.

Parameters:
{Array} options Optional
Label/value list, e.g. {'label':'My label','value':'My Value'}

setRequired(required)

Sets the "required" flag for the field element.

Parameters:
{Boolean} required Optional
Indicator for the required field

setType(type)

Sets the type for the field element.

Parameters:
{String} type Optional
Field type

setValues(values)

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

setVar(var_name)

Sets the var name for the field element.

Parameters:
{String} var_name Optional
Field var name

validate()

Performs validation for XDataField.

Throws:
{jabberwerx.XDataFormField.InvalidXDataFieldError}
If any of the rules for field's values have been violated

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Apr 02 2014 13:23:43 GMT-0600 (MDT)