PDA

View Full Version : [SOLVED]Combobox not submitting typed text



Overlord
14 Aug 2007, 7:47 AM
My combobox will not submit typed text, but will submit a value if selected from the dropbox. I've searched the forums and the threads that I found didn't help. Would someone be able to tell me what I'm doing wrong? I'm using Ext 1.1. Thanks in advance.

//Combo data
Ext.namespace('Ext.infodata');
Ext.infodata.what = [
['the procedure for']
];

...

var what = new Ext.form.ComboBox({
fieldLabel: 'What',
hiddenName:'what',
id:'CBwhat',
name:'CBwhat',
valueField:'what',
store: new Ext.data.SimpleStore({
fields: ['what'],
data : Ext.infodata.what
}),
displayField:'what',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
emptyText:'Select or type your own',
selectOnFocus:true,
width:200
})

14 Aug 2007, 10:31 AM
add a button that does an . What does it do after you type something in? The submit is using the same method to get the data.



alert(what.getValue());

Overlord
14 Aug 2007, 10:36 AM
The alert will display nothing unless I select an option from the dropdown. I do have firebug, if that helps.

Overlord
15 Aug 2007, 5:32 AM
bump

fay
15 Aug 2007, 5:53 AM
The reason why the entered text won't be submitted, or be displayed with what.getValue(), is because you've included a valueField in the combo's config. You can comment out the valueField entry or check before submission for an undefined/empty getValue() - if this is true you can pass getRawValue() in the params option.

I'm guessing that when a valueField is specified and the user enters text, the superclass's value property is updated (and not the combobox.value property). A call to getValue() will return combobox.value (in this case blank).

When no valueField is specified and the user enters text, a call to getValue() will return the superclass.value property.

Hope that makes sense

Overlord
15 Aug 2007, 5:56 AM
Yep, I actually solved it myself and that is exactly what I did. Thank you!