homepage Welcome to WebmasterWorld Guest from 54.166.65.9
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Hardware and OS Related Technologies / Smartphone, Wireless, and Mobile Technologies
Forum Library, Charter, Moderators: bakedjake

Smartphone, Wireless, and Mobile Technologies Forum

    
Limiting Fields to Numeric on Mobile Sites
How do you make it easier for a phone user to enter 12.34 for example?
vertex42




msg:3489444
 8:22 pm on Oct 27, 2007 (gmt 0)

I've created a mobile website that relys on people entering numbers into form fields. While this is not too difficult using a QWERTY keypad, for those of us with 12-key keypads, entering a number like 12.34 can be annoying because to enter a "1" I have to press the "1" key about 10 times, and for the 2, 3, and 4, I have to press the button 4 times each.

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.

 

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Hardware and OS Related Technologies / Smartphone, Wireless, and Mobile Technologies
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved