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.
Try following:
1) Builtin JS validation onsubmit: http://www.phpgrid.org/docs/validation/#js-validation
$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:
http://www.phpgrid.org/docs/validation/#custom-js-validation
and get regex from
https://stackoverflow.com/questions/469357/html-text-input-allow-only-numeric-input