numeric <input> element
Added by Paolo Greppi over 11 years ago
In a WLineEdit with a WDoubleValidator or a WIntValidator, or in a WSpinBox, I can type letters too, and the validator will mark it as invalid.
Consistently, if I click in one of those elements from a mobile device (i.e. tablet running Android) the full keyboard pops up, rather than the numeric keyboard I'd expect.
I think to get the desired behavior you can set either type="number" or pattern="[0-9]*" attributes on the element, whereas the WSpinBox currently sets type="text".
I was looking for a quick hack, and I though "maybe there is a method I can call on the WSpinBox to force that attribute". WWebWidget::setAttributeValue looked good, but did not do what I had expected.
Any suggestions ? TIA
Replies (1)
RE: numeric <input> element - Added by Koen Deforche over 11 years ago
Hey Paolo,
I would have expected that setting the pattern attribute should work (the type attribute is already set internally).
The "number" suggestion is of course spot on --- I've created a feature request for it:
http://redmine.emweb.be/issues/1622
Regards,
koen