[thelist] Fomated tet box question

Jay Blanchard jay.blanchard at niicommunications.com
Wed Mar 9 07:50:27 CST 2005


[snip]
The date represents a event that happened in the past that the user has 
to type in.

Currently there are complaints because typing the '\' takes extra time. 
I would like to have the '\'
already in place so they can just slam the 8 digits for date.

A select or dop-down will take even longer.
[/snip]

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>




More information about the thelist mailing list