PDA

View Full Version : preventMark:true does not work for ComboBox



shalmali
26 Oct 2011, 3:32 PM
Hi,
I have a ComboBox within a CompositeField like so:



var myComboBox = new Ext.form.ComboBox({
name: 'myCombo',
id: 'myCombo',
mode: 'local',
validator: myFunc(),
preventMark: true,
invalidClass: '',
triggerAction: 'all',
forceSelection: true,
editable: false,
hiddenName: 'oValue',
displayField: 'displayText',
valueField: 'setName',
store: this.setsStore
});

var myCompFld = new Ext.form.CompositeField({
id: 'myCompFld',
preventMark: true,
invalidClass: '',
items: [
field1,
field2,
myComboBox,
myButton
]
});


Looks simple enough?
I've given config values of preventMark: true and invalidClass:'' to both the comboxbox and the composite field. I don't want the invalid icon to be shown for invalid fields.
This composite field is enabled when a radio button is selected. The combobox's value is initially set to an empty string and it potentially becomes invalid. That is when the invalid icon gets shown on the side of the combobox.

I've debugged the matter in Firebug, and set a break point in the ext-all-debug.js on the markInvalid function of the Ext.form.Field. When the breakpoint hits this line of code, I can see that the combobox's "preventMark" property is false. Specifically, the code path that calls this markInvalid function is, isValid function is called on each form item with a preventMark=undefined parameter, and the combobox's preventMark=true, gets overwritten with a false value.

Is this a bug or am I doing something wrong?

Any help would be appreciated!

Thanks!

--Shalmali