[thelist] Fomated tet box question

Chris Heilmann lists at onlinetools.org
Wed Mar 9 08:05:27 CST 2005


> How about a little JavaScript that moves the cursor automagically?
> (watch the wrap) A little clever CSS should make this look good to the
> user and you can handle date processing in your own manner (like
> verifying the month is in range and the days are in range, etc)
>
> <script language="javascript">
> function changeCursor(from,to,len) {
> if(from.value.length>=len) {
> 	to.focus();
> }
> return true;
> }
> </script>
> <form name="FORMNAME" action="" method="POST">
> <input style="border: none;" type="text" name="myDay" size="2"
> maxlength="2" value=""
> onkeyup="changeCursor(document.FORMNAME.myDay,document.FORMNAME.myMonth,
> 2)">/
> <input style="border: none;" type="text" name="myMonth" size="2"
> maxlength="2" value=""
> onkeyup="changeCursor(document.FORMNAME.myMonth,document.FORMNAME.myYear
> ,2)">/
> <input style="border: none;" type="text" name="myYear" size="4"
> maxlength="4" value=""><br />
> </form>

That is rather sexy, but it took me a while to see that I enter stuff
there, I thought the script bugged.

Furthermore it changes the normal user expectation: you enter a field and
hit tab to reach the next one. When I enter something here and tab I skip
one field.



More information about the thelist mailing list