Combobox Object
Get the combobox selected option
var objCombo = eform.get('Combo1');
var val = objCombo.getData();
alert(val);
The following example, which is a pull-down list of product name (display value) and product code (key value). The product code is stored as key value which is invisible to end user.
We can use the HTML code to describe the relationship between display and key value:
<select>
<option value=”P0001”>Product A</option>
<option value=”P0002”>Product B</option>
</select>
The combobox will return Product A||P0001 as the value, the first value is the display value, the second one is key value, which are separated by a double pipe.
If you want to get only the display value, you can use getDisplay(), on the other hand, the key value can use getKey(), which will be described in next two tables.
Get the combobox display value of the selected item.
var objCombo = eform.get('Combo1');
var val = objCombo.getDisplay();
alert(val);
Return the visibility of the combobox as true or false
var objCombo = eform.get('Combo1');
var val = objCombo.getVisible();
alert(val);
Return whether the combobox is read-only as true or false
var objCombo = eform.get('Combo1');
var val = objCombo.isReadOnly();
alert(val);
Set the combobox content
Parameters:
- val = A string value
var objCombo = eform.get('Combo1');
objCombo.setData('Product B');
Set the combobox as read-only or not
Parameters:
- isReadOnly = true/false, for set read only to true or false and disable the input
var objCombo = eform.get('Combo1');
objCombo.setReadOnly(true);
Set the combobox as visible or not
Parameters:
- isVisible = true/false, for set visible to true or false and disable the input
- isPermenant = Save the visible state or not. If this set to true, the visibility of the control is saved with the eform, if not that visibility control is one off only
var objCombo = eform.get('Combo1');
objCombo.setVisible(true,true);
Get the combobox key value of the selected item.
var objCombo = eform.get('Combo1');
var val = objCombo.getKey();
alert(val);
Get the combobox key value of the selected item.
var objCombo = eform.get('Combo1');
var val = objCombo.getSelected();
alert(val);
Commenting is not enabled on this course.