isSelected
Checks if the given value in the field is selected or not.
Description
vcc.isSelected(field: string, [value: string], [key: string]): bool
Parameters
field
The name of the field.
value
The value you want to look for.
key
The name of the value property (DEFAULT: valueid).
Return values
bool
If the value parameter is missing, it returns true if:
- text field – the field is not empty
- simple field – there is a selected value
- multiple field – there are selected values
If the value parameter exists, it returns true if:
- text field – the value of the field is exactly the same as the given value (the 3rd parameter is unused in this case)
- simple field – there is a selected element and it’s property defined by the key is exactly the same as the given value.
- multiple field – there are selected values whose properties defined by the key are exactly the same as the given value.
Example
$('page1').onNext = function() {
// text field
dump(vcc.isSelected('haircolor_text', 'brown'));
// simple field, the description of the selected value is 'budapest'
dump(vcc.isSelected('hometown_radio', 'budapest', 'description'));
// multiple field, there is a selected value which export_value is 'MTV'
dump(vcc.isSelected('tvchanels_checkbox', 'MTV', 'export_value'));
};
Comments
Can’t find what you need? Use the comment section below to connect with others, get answers from our experts, or share your ideas with us.
There are no comments yet.