Constructor
new Select(name)
Constructs a new Select component instance
Parameters:
Name | Type | Description |
---|---|---|
name |
String | Name of the component, used as name of the html controls. |
- Source:
Returns:
A newly created Select component
Methods
checkOptions(reqData)
Checks user input for optiongroups: Unless require("checkoptions")
has ben set to false, the user input must exist in the option array.
Parameters:
Name | Type | Description |
---|---|---|
reqData |
Object | request data |
- Source:
Returns:
null if everything is ok or string containing error message
checkRequirements(reqData)
Validates user input from a dropdown element by making sure that
the option value list contains the user input.
Parameters:
Name | Type | Description |
---|---|---|
reqData |
Object | request data |
Returns:
string containing error message or null if everything is ok.
getFirstOption()
Returns the text that should be displayed if no value is selected.
- Source:
getOptions()
Returns the option list for this component.
- Source:
parseOptions()
Creates an array of options for a dropdown element or a
group of radiobuttons. If options field of this element's
config is an array, that array is returned.
If options is a function, its return value is returned.
- Source:
Returns:
array of options
renderControls(attr, value, reqData)
Renders a dropdown element to the response.
Parameters:
Name | Type | Description |
---|---|---|
attr |
Object | Basic attributes for this element. |
value |
Object | Value to be used for rendering this element. |
reqData |
Object | Request data for the whole form. This argument is passed only if the form is re-rendered after an error occured. |
- Source:
setFirstOption(newFirstOption)
Sets the text that is displayed if no value is selected
Parameters:
Name | Type | Description |
---|---|---|
newFirstOption |
String | text to display as first option element. |
- Source:
setOptions(newOptions)
Sets the option list for this component.
The argument may either be an array that will be used as option list,
or a function that is called when the option component is rendered and
has to return an option array.
For both arrays those formats are allowed:
Array of arrays
Array of objects
Array of strings
[ [val, display], [val, display], .. ]
[ {value:val, display:display}, .. ]
[ display, display, .. ]
In this case,
the index position of the string will be the value.Parameters:
Name | Type | Description |
---|---|---|
newOptions |
Array | function | Array or function defining option list. |
- Source: