on 2017 Feb 20 11:22 AM
Hi all,
I have an input field which should accept only numeric values from the user. I have given its type to be 'Number'. It works fine. But the problem is, it accepts the character 'e'. Is there any other way to validate this?
Here's my code:
<Input id="idlinemgr" width="100%" type="Number" value="" placeholder="Enter here" liveChange="handleLiveChange" />
Can anyone help me with this?
Thanks & Regards,
Ramya
Request clarification before answering.
You can prevent an Input from accepting chars that are not digits by adding an event delegate on keypress:
oInput.addEventDelegate({
onkeypress: function(oEvent) {
if (oEvent.key < '0' || oEvent.key > '9') {
oEvent.preventDefault()
}
}
})
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
34 | |
21 | |
14 | |
8 | |
5 | |
4 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.