PDA

View Full Version : Element have no name-attribute...



gilaras
9 Apr 2012, 11:02 PM
Hi there,

while developing a little web-app, I encountered a weired situation ...

The page has a combobox, where the user can select his/her gender. In the code, i assigned the name "anrede" to it. I deployed the application, tested it...but the parameter "anrede" could not be found.
I was a little confused when I found out that the input didn't have any name attributed attached to it ... although I specified it. Same problem with another element - some radio buttons - further down on the page.

I solved the problem by assigning a name by hand, using document.findElementById()... and traversing down to the input element, but that's not the way it should work I guess ;-)

Anyone got any idea what might be wrong? Here's a part of the code by the way ...


var anredeCombo = {
xtype: 'combo',
mode: 'local',
emptyText:' ',
forceSelection: 'true',
fieldLabel: 'Anrede',
editable: 'false',
name: 'anrede',
id: 'anrede',
displayField: 'display',
valueField: 'value',
queryMode: 'local',
store: Ext.create('Ext.data.Store', {
fields: ['display', 'value'],
data: [
{'display': 'Herr', 'value': 'm'},
{'display': 'Frau', 'value': 'w'}
]
})
};


Do I miss something?! I don't know ...


Thanks in advance and greetz
gilaras

vietits
10 Apr 2012, 12:25 AM
Default implementation of combobox does not include name attribute in its respective input element. You can include name attribute by changing field template:


var anredeCombo = {
xtype: 'combo',
mode: 'local',
emptyText:' ',
forceSelection: 'true',
fieldLabel: 'Anrede',
editable: 'false',
name: 'anrede',
id: 'anrede',
displayField: 'display',
valueField: 'value',
queryMode: 'local',
store: Ext.create('Ext.data.Store', {
fields: ['display', 'value'],
data: [
{'display': 'Herr', 'value': 'm'},
{'display': 'Frau', 'value': 'w'}
]
}),
fieldSubTpl: [
'<div class="{hiddenDataCls}" role="presentation"></div>',
'<input id="{id}" type="{type}" name="{name}"',
'<tpl if="size">size="{size}" </tpl>',
'<tpl if="tabIdx">tabIndex="{tabIdx}" </tpl>',
'class="{fieldCls} {typeCls}" autocomplete="off" />',
'<div id="{cmpId}-triggerWrap" class="{triggerWrapCls}" role="presentation">',
'{triggerEl}',
'<div class="{clearCls}" role="presentation"></div>',
'</div>',
{
compiled: true,
disableFormats: true
}
]
};