Ext JS Tip : How To Make ComboBox Send Value Field.

19 05 2008

When you use Ext JS’s ComboBox, if you don’t set hidden name or id, it send display field value, not value field. To handle this, it has to be set. Be careful about uniqueness of the hidden name, for more details you can check Ext JS ComboBox’s documantation

var unitField = new Ext.form.ComboBox({   
    id:'unitField',   
    name: 'unit',   
    fieldLabel: 'Unit',   
    store:unitStore,   
    mode: 'remote',   
    displayField: 'name',   
    valueField: 'id',   
    hiddenName : 'unitId',   
    allowBlank: false,   
    anchor:'95%',   
    triggerAction: 'all'
});

Actions

Information

22 responses

22 05 2009
boybles

All I gotta say is YOU ROCK! This helped me resolve my problem very quickly. Couldn’t figure out what the problem was until I read this. Reading the documentation is important, but it’s easy to miss things like this. Thanks!!!
Tony

3 12 2010
Gokul

Hello help me!
How to get the HiddenName value of combo box , give some code plz..!

3 12 2010
turgaykivrak

What do you want to do exactly? send the selected value in a form post or find the combobox component and get the hiddenName from the compoenent in javascript?

24 07 2009
Lilit

Awesome, I was looking for ways to overcome this problem, but your solution is simplest and most beautiful.

Thanks,
-Lilit

14 12 2009
ExtJs 学习随笔 | 天天成长的博客

[...] comboBox 设置发送到数据库的值 http://turgaykivrak.wordpress.com/2008/05/19/extjs-20-tip-how-to-make-combobox-send-value-field/ 转载本文请注明:转载自 天天成长的博客 http://www.ddgrow.com [...]

12 03 2010
Yutu

Thank you!!!!

21 03 2010
Olexiy

thanks :)

26 03 2010
alexxx

thank you, i can resolve my problem………………………..

11 07 2010
kangkam

hoaaaaaaaaaaaaaaaahh… you help me a looootttt

thank you :) )

17 08 2010
riri

TTTTTTTTTTHHHHHHHHHHHHHHHAAAAAAAAAAAAANNNNNNNNNKKKKKKKKK YYYYYYYYYOOOOOOOOOUUUUUUUUUUUUUUUUU

i mean thank you very much!

10 09 2010
joe123

Thanks a lot! Took me f*cking hours to find this!

17 09 2010
Greivin

great!

31 10 2010
Mark Drabant

Thanks!!! :-)

3 11 2010
Maverick

Extremely helpful. Thanks a lot

12 11 2010
1 12 2010
Ricardo Rios

Still does not work for me…

var combo_organismosID = new Ext.form.ComboBox({
labelStyle: ‘font-weight:bold;’,
fieldLabel:’Organismo’,
displayField: ‘organismo’,
valueField: ‘valor’,
forceSelection:true,
minChars: ’1′,
typeAhead: true,
editable : true,
autoLoad:true,
name:’combo_organismos’,
mode: ‘remote’,
selectOnFocus:true,
emptyText:’Organismo Responsable del Proyecto…’,
id:’organismo’,
triggerAction:’all’,
store:organismos,
hiddenname: ‘valor’,
allowBlank:false
});

3 12 2010
turgaykivrak

hiddenname: ‘valor’ should be hiddenName:’valor’ and in the form post, it will send the value as valor.

8 12 2010
jtechnical

Thank you. it worked

26 12 2010
Sush

Thanks for setting focus on hidden attrib :)

10 01 2011
Suji

Hi, Im new to php crosstab reports ,so want how to create the crosstab reports.pls help meeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee………………………….

10 01 2011
turgaykivrak

Hi,
Unfourtunately I am not a php developer/expert. But I think you can find samples by googling.

Maybe also some javascript code.

Kind regards
Turgay

22 04 2011
betteridmblogun

Helped me too. Only side effect is now when you do form.getValues, you get an extra field with same value as the actual combo. I wish I could get away from that, but it’s only an inconvinience.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s




Follow

Get every new post delivered to your Inbox.