[thelist] Fomated tet box question

Chris Heilmann lists at onlinetools.org
Wed Mar 9 07:10:25 CST 2005


> Brian
>
>> My users enter a data in a simple text box.
>>
>> I would like the box to just except the date and not have to type the
>> slashes '\' for 03\09\2005
>>
>> example:
>>
>> ______________
>>     \      \
>> ______________
>>
>> I have read a little about masked text boxes,but there had to be a
>> easier way.
>
> I have had success using select boxes instead of text fields. I use
> javascript to dynamically change the number of days available as the
> selected values in the month and year select boxes are changed. If the
> user
> does not have javascript available, 31 days are available for each month.
> Validation is performed on the server, as should always be done with any
> form input. The order that the month and day select boxes are displayed
> can
> be changed depending on the information ganied regarding the user's
> geographical location. This, in addition to explicit labelling, reduces
> any
> confusion regarding date formats between US and UK formats. It also
> requires
> no extra logic when the date is processed on the server. The default value
> can be today's (or any, for that matter) date. Is there any particular
> rerason that yuo want to allow the user to input free text for a date?

Accessibility? Rather than selecting three values from three dropdowns the
user only needs to add one field. Try filling the three dropdown solution
with a screenreader / speech recognition / keyboard. Personally, I prefer
a free field enhanced with a popup calendar - if your browser supports
that.
http://www.onlinetools.org/articles/unobtrusivejavascript/ex_picker.html

Confusion on the date format can be handled with a good label:
Please select the start date (f.e. 26/04/1975).
No extra logic on the server sounds insecure, and you'd need it in your
example, as that form without JS allows me to send 31st of February.
Validation is partly our problem, we shouldn't share it with the user.

-- 
Chris Heilmann
Blog: http://www.wait-till-i.com
Writing: http://icant.co.uk/
Binaries: http://www.onlinetools.org/



More information about the thelist mailing list