Class inputEx.Field
- Known Subclasses:
-
inputEx.CheckBox
inputEx.ListField
inputEx.Textarea
inputEx.VectorField
inputEx.Group
inputEx.SerializeField
inputEx.RadioField
inputEx.MenuField
inputEx.FileField
inputEx.ColorPickerField
inputEx.TypeField
inputEx.UneditableField
inputEx.ColorField
inputEx.RTEField
inputEx.MapField
inputEx.SelectTwiceField
inputEx.SelectField
inputEx.SliderField
inputEx.StringField
inputEx.InPlaceEdit
inputEx.HiddenField
inputEx.TinyMCEField
An abstract class (never instantiated) that contains the shared features for all fields.
Constructor
inputEx.Field
(
options
)
- Parameters:
-
options
<Object>
Configuration object
- name: the name of the field
- required: boolean, the field cannot be null if true
- className: CSS class name for the div wrapper (default 'inputEx-Field')
- value: initial value
- parentEl: HTMLElement or String id, append the field to this DOM element
Properties
Configuration object to set the options for this class and the parent classes. See constructor details for options added by this class.
Methods
void
clear
(
[sendUpdatedEvt]
)
Clear the field by setting the field value to this.options.value
- Parameters:
-
[sendUpdatedEvt]
<boolean>
(optional) Wether this clear should fire the updatedEvt or not (default is true, pass false to NOT send the event)
void
close
(
)
Close the field and eventually opened popups...
void
destroy
(
)
Purge all event listeners and remove the component from the dom
void
disable
(
)
Disable the field
void
displayMessage
(
msg
)
Update the message
- Parameters:
-
msg
<String>
Message to display
void
enable
(
)
Enable the field
void
fireUpdatedEvt
(
)
Fire the "updated" event (only if the field validated)
Escape the stack using a setTimeout
void
focus
(
)
Focus the field
HTMLElement
getEl
(
)
The default render creates a div to put in the messages
- Returns:
HTMLElement
- divEl The main DIV wrapper
inputEx.Group|inputEx.Form|inputEx.ListField|inputEx.CombineField
getParentField
(
)
Return the parent field instance
String
getState
(
)
Returns the current state (given its value)
- Returns:
String
- One of the following states: 'empty', 'required', 'valid' or 'invalid'
void
getStateString
(
)
Get the string for the given state
Any
getValue
(
)
Return the value of the input
- Returns:
Any
- value of the field
void
hide
(
)
Hide the field
void
initEvents
(
)
Initialize events of the Input
void
isDisabled
(
)
Check if the field is diabled
void
isEmpty
(
)
Should return true if empty
void
onBlur
(
e
)
Function called on the blur event
- Parameters:
-
e
<Event>
The original 'blur' event
void
onChange
(
e
)
onChange event handler
- Parameters:
-
e
<Event>
The original 'change' event
void
onFocus
(
e
)
Function called on the focus event
- Parameters:
-
e
<Event>
The original 'focus' event
void
render
(
)
Default render of the dom element. Create a divEl that wraps the field.
void
renderComponent
(
)
Render the interface component into this.divEl
void
setClassFromState
(
)
Set the styles for valid/invalide state
void
setFieldName
(
)
Set the name of the field (or hidden field)
void
setOptions
(
options
)
Set the default values of the options
- Parameters:
-
options
<Object>
Options object as passed to the constructor
void
setParentField
(
parentField
)
Set the parentField.
Generally use by composable fields (ie. Group,Form,ListField,CombineField,...}
- Parameters:
-
parentField
<inputEx.Group|inputEx.Form|inputEx.ListField|inputEx.CombineField>
The parent field instance
void
setValue
(
value
,
[sendUpdatedEvt]
)
Function to set the value
- Parameters:
-
value
<Any>
The new value
-
[sendUpdatedEvt]
<boolean>
(optional) Wether this setValue should fire the updatedEvt or not (default is true, pass false to NOT send the event)
void
show
(
)
Show the field
Boolean
validate
(
)
Validation of the field
- Returns:
Boolean
- field validation status (true/false)
Events
updatedEvt
(
value
)
Event fired after the user changed the value of the field.
- Parameters:
-
value
<Any>
The new value of the field