New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ComboBox: formBind buttons not updated if forceSelection and initially empty #1598

Closed
fabriciomurta opened this Issue Jul 25, 2018 · 2 comments

Comments

Projects
None yet
1 participant
@fabriciomurta
Contributor

fabriciomurta commented Jul 25, 2018

Found: 4.7.0
Ext.NET forum thread: Button not enabled after combobox has used Forceselection
Sencha forum thread: Ext.form.field.Combobox validation issue when forceSelection+formBind

When a combo box has an initially empty value, is editable (can input text on its text field) and ForceSelection = true, if an invalid text (anything not matching an entry within the combo) is entered, then:

  • checkValidityChange() is triggered, as if the field were to become valid.
  • the ForceSelection algorithm will deny the validity, as the combo box's value is set back to empty (its previous value)

Then when actually selecting a valid combo box' entry, the validity change even won't be triggered. Basically because it thinks the last validity change trigger was from false to true (which is again being triggered).

So, best ensure the combo box knows it went back to the false state. Although isValid() returns false, somewhere still tells the validity change was not again from false to true, so it never triggers again when actually selecting a valid value in the combo box.

The issue has been reproduced in pure Ext JS in this fiddle: forceSelection+initially empty combobox issue with validation.

@fabriciomurta

This comment has been minimized.

Show comment
Hide comment
@fabriciomurta

fabriciomurta Aug 2, 2018

Contributor

Update: Issue still open after ExtJS 6.6.0 release. Issue has not been reviewed by Sencha.

Contributor

fabriciomurta commented Aug 2, 2018

Update: Issue still open after ExtJS 6.6.0 release. Issue has not been reviewed by Sencha.

@fabriciomurta

This comment has been minimized.

Show comment
Hide comment
@fabriciomurta

fabriciomurta Aug 7, 2018

Contributor

The validityChange event was not being triggered, because the new validateOnFocusLeave feature kicked in too early and validated the field before the combo box's assertion took place; and when the assertion played its role, no validation update was done. So, if a 'forceSelection' combo box had an invalid value typed in:

  1. validateOnFocusLeave would validate the invalid value as valid, because the field was not empty
  2. assertion would switch the value back to empty
  3. no validation would be played, so the empty field would still be marked as valid
  4. when an actual value was selected from the combo box, the validity status would switch from true to true, meaning it wouldn't call the validityChange event at all.

So, now in step 2, we re-run the validation code if the value changed. This would also help on advanced validation, for example, if regex validation and the previous result was a regexp-denied, the typed one regexp-ok, but forceSelection demanded the previous value to be selected. This could be true on a combo box with a "Choose a value" entry to suggest the user to choose a combo entry; yet that value should not be accepted as a choice.

We'll have to keep an eye open for Sencha fixing this issue in the future on their own.

Contributor

fabriciomurta commented Aug 7, 2018

The validityChange event was not being triggered, because the new validateOnFocusLeave feature kicked in too early and validated the field before the combo box's assertion took place; and when the assertion played its role, no validation update was done. So, if a 'forceSelection' combo box had an invalid value typed in:

  1. validateOnFocusLeave would validate the invalid value as valid, because the field was not empty
  2. assertion would switch the value back to empty
  3. no validation would be played, so the empty field would still be marked as valid
  4. when an actual value was selected from the combo box, the validity status would switch from true to true, meaning it wouldn't call the validityChange event at all.

So, now in step 2, we re-run the validation code if the value changed. This would also help on advanced validation, for example, if regex validation and the previous result was a regexp-denied, the typed one regexp-ok, but forceSelection demanded the previous value to be selected. This could be true on a combo box with a "Choose a value" entry to suggest the user to choose a combo entry; yet that value should not be accepted as a choice.

We'll have to keep an eye open for Sencha fixing this issue in the future on their own.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment