Skip to content
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

NumberTextBox.isValid does not work with trim #204

Open
xmedeko opened this issue May 3, 2023 · 0 comments
Open

NumberTextBox.isValid does not work with trim #204

xmedeko opened this issue May 3, 2023 · 0 comments

Comments

@xmedeko
Copy link
Contributor

xmedeko commented May 3, 2023

I have

<input data-dojo-type="dijit/form/NumberTextBox" data-dojo-props="constraints:{min:0,max:20,places:0}, intermediateChanges:true, trim:true"/>

and check in the code

numberTextBox.on("change", () => {
    okButton.set("disabled", numberTextBox.isValid());
});

This does not work when user enters a number with spaces, e.g. " 12 ". The checkbox show no error, but numberTextBox.isValid() returns false. I.e. if isValid() checks text value, it should do filter first.

Update: Workaround is to call NumberTextBox._setBlurValue() on change:

numberTextBox.on("change", () => {
    numberTextBox._setBlurValue();
    okButton.set("disabled", numberTextBox.isValid());
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant