Reputation: 1182
I have a checkboxgroup and a radiogroup. For both of them, I want to catch several values. For the checkboxGroup
var DescCheck = new Ext.form.CheckboxGroup({
fieldLabel: 'Description of service : <span style="color: rgb(255, 0, 0); padding-left: 2px;">*</span>',
width : 540,
labelSeparator : '',
items: [
{boxLabel: 'Direct', name: 'Direct', inputValue: 'Direct'},
{boxLabel: 'Fixed-day', name: 'day', inputValue: 'Fixed'},
{boxLabel: 'Weekly', name: 'Weekly', inputValue: 'Weekly'}
]
});
I tried DescCheck.getValue()
but it returned me
[object Object]
I tried DescCheck.getValue().inputValue
and it returned me nothing.
For the radioGroup
var TypeCheck = new Ext.form.RadioGroup({
items: [
{boxLabel: 'New 1', name: '1', inputValue: '1'},
{boxLabel: 'New 2', name: '2', inputValue: '2'},
{boxLabel: 'New 3', name: '3', inputValue: '3'}
]
I tried TypeCheck.getValue().inputValue
but it returned only the first selected item. How can I catch several checked boxes?
Upvotes: 0
Views: 9254
Reputation: 867
In my project works this below...
var selectedOptions = DescCheck.getChecked(); // DescCheck.getValue();
for (var i = 0; i < selectedOptions.length; i++) {
console.log( selectedOptions[i].inputValue );
}
Upvotes: 0
Reputation: 3211
Did you tried getChecked for getting all checked boxes.
DescCheck.getChecked();
Update
You should use getValue()
, It returns the array of selected values.
You can get that by looping through array like this
var selectedValue = DescCheck.getValue();
for(var i=0;i<selectedValue.length;i++){
console.log(select[i].inputValue);
}
Upvotes: 6