dojo / dojo/dijit

NumberTextBox.isValid does not work with trim

Open
#204 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
172
Forks
180
PR merge metrics
No merged PRs in 30d

Description

I have
```html

```
and check in the code
```js
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:
```js
numberTextBox.on("change", () => {
numberTextBox._setBlurValue();
okButton.set("disabled", numberTextBox.isValid());
});
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.