Allow only numeric in input

QuestionsAllow only numeric in input
Anonymous asked 2 years 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 2 years 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

6 + 4 =

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 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

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

Let us improve this post!

Tell us how we can improve this post?