Skip to content

NumberTextBox.isValid does not work with trim #204

@xmedeko

Description

@xmedeko

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());
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions