PDA

View Full Version : value of the comboBox when a form submited



freezq
29 Jun 2010, 10:20 PM
var combo1 = new Ext.form.ComboBox({
typeAhead: true,
triggerAction: 'all',
lazyRender:true,
mode: 'local',
fieldLabel:'AllowNull',
hiddenName:'combo1',
id:'nullable',
editable:false,
store: new Ext.data.ArrayStore({
id: 0,
fields: [
'myId',
'displayText'
],
data: [[1, 'Yes'], [0, 'No']]
}),
valueField: 'myId',
displayField: 'displayText'
});

i use Ext.getCmp('combo1').setValue("Yes") to display "Yes".but i want to pass the value 1 to the server when the form submited.how can i do that?

sam.arulprakash
29 Jun 2010, 10:22 PM
For Selected Value =>combo1.getRawValue();
For Selected Text =>combo1.getValue();

freezq
29 Jun 2010, 11:02 PM
For Selected Value =>combo1.getRawValue();
For Selected Text =>combo1.getValue();

Thank you, i know how to get the value, but i want the ext to send the value.


if(form.form.isValid()){
this.disabled = true;
form.form.doAction('submit',{
url:'insertDetailList',
method:'post',
waitTitle:'',
waitMsg:"",
params:'',
success:function(form,action){
Ext.Msg.alert('',action.result.data);
this.disabled = false;
}
})
}

how to let the ext to send the selected value of combo1?

freezq
29 Jun 2010, 11:05 PM
Thanks! i know how to get the value,i just want to know how to let the form send the selected value .
the code below do the post action and send the selected text but not selected value.


if(form.form.isValid()){
form.form.doAction('submit',{
url:'insertDetailList',
method:'post',
waitTitle:'',
waitMsg:"",
params:'',
success:function(form,action){
}
})
}

freezq
29 Jun 2010, 11:35 PM
solved! i should use Ext.getCmp('combo1').setValue(1),not Ext.getCmp('combo1').setValue("Yes").