Opened 6 years ago

Closed 6 years ago

Last modified 4 years ago

#17405 closed defect (invalid)

dojox/mobile/TextBox with numeric type

Reported by: User# Owned by: Adrian Vasiliu
Priority: undecided Milestone: tbd
Component: DojoX Mobile Version: 1.9.1
Keywords: Cc:
Blocked By: Blocking:

Description

Hello,

I would like to set the type "numeric" to my TextBox? in order to open the numeric keyboard by default on mobile devices.

Solution 1:

<input data-dojo-type="dojox/mobile/TextBox"
       data-dojo-props="value: at(this.loadedModels.NumberModel, 'Value'),
                        onChange: lang.hitch(this, this.numberChanged),
                        intermediateChanges: true,
                        type: 'numeric'"></input>

Bug: The default keyboard on mobile device is NOT the numeric keyboard.

Solution 2:

<input data-dojo-type="dojox/mobile/TextBox"
       data-dojo-props="value: at(this.loadedModels.NumberModel, 'Value'),
                        onChange: lang.hitch(this, this.numberChanged),
                        intermediateChanges: true"
       type="numeric"></input>

Bug: The function "numberChanged" is not called if the user inserts at least one character which is not a number (example: letter "a").

Do you know how to fix these bugs please ??

Thank you

Change History (4)

comment:1 Changed 6 years ago by User#

I made a mistake in the description, please read "number" instead of "numeric" for the input type. Sorry.

comment:2 Changed 6 years ago by Adrian Vasiliu

Owner: set to Adrian Vasiliu
Status: newassigned

comment:3 Changed 6 years ago by Adrian Vasiliu

Resolution: invalid
Status: assignedclosed

As specified by the HTML5 spec, you shouldn't set the type "numeric", but "number". See for instance https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input . Also, the type is an HTML attribute of the input tag, it is not a property of the widget. All in one, this works:

<input type="number" data-dojo-type="dojox/mobile/TextBox" ...>

At least on iOS 6 and Android 4.2, touching it pops the numeric virtual keyboard.

Finally, if the type is number, it is expected and understandable that onChange doesn't fire when you enter an invalid character (a letter).

Therefore, I'm closing the ticket for now, but of course it can be reopen if appropriate.

comment:4 Changed 4 years ago by swiftfoot

I would like to reopen this. We would like to receive this invalid data and popup a validation error message to the end user to notify them that they have a typo in their number value.

Can we please?

Note: See TracTickets for help on using tickets.