PDA

View Full Version : [OPEN-1273] Form field with name "length" causes submit no fields in IE6



nosferatum
19 Sep 2010, 2:27 AM
My sample code is just extjs part of creating simple form. Tried to keep it as simple as it can, although searching this IE bug took me some hours to discover.

<script type="text/javascript">
Ext.onReady(function() {
Ext.QuickTips.init();

var formPanel;
formPanel = new Ext.FormPanel({
renderTo: Ext.getBody(),
defaultType: 'textfield',
bodyStyle: 'padding: 5px;',

items:
[
{ // name
name: 'name',
fieldLabel: 'Name',
allowBlank: false
},
{ // length
name: 'length', // THIS CAUSES A BUG IN IE
fieldLabel: 'Length',
allowBlank: false
}
],

buttons:
[
{
text: 'Save',
handler: function() {
if (formPanel.getForm().isValid())
{
// Ext.MessageBox.alert('form values:' + formPanel.getForm().getValues(true)); // UNCOMMENT THIS TO SEE THE FORM VALUES
formPanel.getForm().submit({
url: '/brandCreate',
success: function() {
Ext.MessageBox.alert('Success!')
},
failure: function() {
Ext.MessageBox.alert('Failure!')
},

waitMsg: 'Please wait'
});
}
}
}
]
});

formPanel.show();
});
</script>

When submitting this form in IE6, neither 'name' nor 'length' request params are set. If you look for formPanel.getForm().getValues(true) in submit function, it shows empty string in IE6.

Changing field's name to 'len' or anything other then 'length' corrects the behaviour.
The code works OK in FF ('name' and 'length' params are set correctly).
Not sure about other browsers (it has to be tested), but supposedly it's idiotic IE bug.

I think this special case should be taken into account in Ext someway like renaming this field before submitting in case of IE. Or it should be added to documentation, that users must not set field's name to 'length'.

Jamie Avins
20 Sep 2010, 9:26 AM
Opened this as a documentation issue.