View Full Version : ComboBox + transform + forceSelection = false
jeffiel
23 Mar 2007, 3:46 PM
Problem:
It seems that if you use a transform, it creates a hidden element which works well for selection-only combos. However, if you allow entry of new values (forceSelection: false and no valueField), then when the user types in a new value (not a selection), it doesn't update the hiddenfield value.
Workarounds:
- update hiddenfield on blur
- don't use transform, but use applyTo instead
Is my evaluation of the functionality correct?
Hi,
I'm facing the exactly same problem. Could you please describe in a little more detail how to solve this issue?
thanks in advance!
cheers
Kai
jsakalos
6 May 2007, 2:01 PM
I'll give you just a viewpoint, not solution.
The standard combo is collection of name/value pairs. Name is displayed for user to select and value is sent to server in the case of submit. Right?
Now, if you type the new text it is name but what is the value? I would say it needs further application processing to determine the value.
Either the new name is sent to server, server stores it to a table and returns back an id that will become the new value for the text or application decides what the value is.
Just thoughts...
thats clear to me, thanks. But I was curious what the OP wanted to say with "don't use transform, but use applyTo instead" and with his other proposed solution...
jsakalos
6 May 2007, 3:59 PM
jeffiel,
go on and explain. Maybe I'm missing the point.
I just wanted to have some source that would be useful for me ;-)
Anyway, I'm now using the following code:
var converted = new Ext.form.ComboBox({
typeAhead: true,
triggerAction: 'all',
transform:'state',
width:135,
forceSelection:false,
editable:true
});
Ext.EventManager.addListener(converted.hiddenField.form,
"submit", function(){
converted.hiddenField.value = converted.getRawValue();
}
});
This way the hiddenField would be set to the raw value of the combo box whenever the surrounding form is getting submitted.
thanks for your help!
cheers
Kai
jsakalos
7 May 2007, 7:45 AM
Ah, I see. You want to have value = display text for new texts.
OK
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.