You found a bug! We've classified it as
EXTJS-27595
.
We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
-
Sencha User
[6.6.0 classic] Ext.form.field.Combobox validation issue when forceSelection+formBind
In a very specific scenario, Ext.form.Panel's buttons with 'formBind' won't be enabled when valid value is chosen to a combo box.
Scenario:
- A form panel, with a combo box and buttons
- The combo box should initially have no selected values
- The combo box should have 'forceSelection: true', and 'allowBlank: false'
- The form panel should have at least one of the buttons with 'formBind: true' set
If you feed an invalid vaue in the combo box's input field, it will trigger its 'validityChange' event. But 'forceSelection' will force it back to empty. The validity state of the combo box will then still read as not valid (as the whole form).
If then (after choosing that invalid value) you select a valid entry from its dropdown list, the 'validityChange' event won't fire. Queryting the form's or field's 'isValid()' will return true, yet the buttons won't be enabled.
The way to fix this is ensure the combo box calls 'checkValidityChange(combobox.isValid())', which can be just added to the 'select' event of the combo box, or also just updating the combobox's 'wasValid' during the 'beforeselect' event. The latter approach is applied in the fiddle provided below.
Here's the fiddle with details to reproduce it, and the above mentioned workaround:
This issue has been around since at least version 5 series, yet I couldn't find an open thread that clearly refers to this specific issue.
-
Ext Support Team
Hello, hope you are doing well.
We appreciate you bringing this to our notice, we will go ahead and register this in our bug tracker. Please note that the reference number will be attached here for you to track the issue.
Regards,
Kumar
Sencha Support.
-
Sencha Staff
Thanks for the report! I have opened a bug in our bug tracker.