Allow only numeric in input

QuestionsAllow only numeric in input
Anonymous asked 3 weeks ago

What the $col option to only allow a user to enter digits? One of my fields is a varchar but I don’t want the user to be able to enter anything other¬†than digits.

1 Answers
Abu answered 3 weeks ago

Try following:

1) Builtin JS validation onsubmit:
$col[“editrules”] = array(“number”=>true);

2) Using oninput JS callback:
$col = array();
$col[“title”] = “Total”;
$col[“name”] = “freight”;
$col[“width”] = “170”;
$col[“editoptions”][“oninput”] = “this.value = this.value.replace(/[^0-9.]/g, ”).replace(/(\..*)\./g, ‘$1’);”;

3) You can also use custom client side validation using:
and get regex from

Your Answer

20 + 19 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.

How useful was this discussion?

Click on a star to rate it!

Average rating / 5. Vote count:

We are sorry that this post was not useful for you!

Let us improve this post!