Forum Moderators: bakedjake
Many phones (if not most) have a way to switch to a "number mode", but at least on my phone, the number mode doesn't let you enter a decimal point "." So that means I would have to waste 9 button presses to switch into, then out of, then back into number mode.
I suppose expert text messagers may not care about this, but I'm not an expert text messager, nor do I plan to be.
What I have done so far to make it faster to enter values is to allow so-called "telenumeric" entries, in which you could enter the value "!a.dg" to represent "12.34" or "dEt" to represent "3E8" (the speed of light in case you were wondering).
I created the following script to do the conversion from "telenumeric" to numeric:
<?php
function tonum($v) {
if (!is_numeric($v) ) {
$v = eregi_replace("[#\$\s]","",$v); // strip spaces, $, #
$v = eregi_replace("[a-c]","2",$v);
$v = eregi_replace("[df]","3",$v);
$v = eregi_replace("[g-i]","4",$v);
$v = eregi_replace("[j-l]","5",$v);
$v = eregi_replace("[m-o]","6",$v);
$v = eregi_replace("[p-s]","7",$v);
$v = eregi_replace("[t-v]","8",$v);
$v = eregi_replace("[w-z]","9",$v);
$v = eregi_replace("[^a-z0-9.,-]","1",$v);
return $v;
} else {
return $v;
}
}
?>
I'd be interested in feedback on this technique, or if there is a better way to make it easier to enter numbers into form fields on a mobile site, I'm all ears.
Thanks.