W3C home > Mailing lists > Public > w3c-wai-ig@w3.org > October to December 2008

Re: An accessible way to format Date and Social Security Number form fields?

From: Isofarro <lists@isofarro.uklinux.net>
Date: Sun, 02 Nov 2008 10:41:35 +0000
Message-ID: <490D83DF.9010301@isofarro.uklinux.net>
To: w3c-wai-ig@w3.org

Jennifer Gauvreau wrote:
> The question is when to prefill the hyphen, slash, dollar sign, and/or 
> comma. The team proposed three options:
> 1. As user is entering their value
> 2. After the user enters their value and the focus is lost from the field.
> 3. After saving the entry to the database.

Step 3, because that's the most stable way of doing it. Steps 1 & 3 
create a dependency on JavaScript, and more annoyingly, change the data 
while it is being entered. This can create confusion when the user is 
editing or checking data they've just entered.

For the date format, specify the order (e.g. 'dd/mm/yy'), but allow the 
separator character to be anything, or not used. The backend should be 
able to find matches using regex - something like \d{2}\D?\d{2}\D?\d{2}.

The key is for the backend to be able to deal with any date thrown at it 
- where it is unambigious. When a date is ambigious, then there's an 
error on the form, so send the form back and ask the user to correct the 
date so that it isn't so ambigious -- but give them back the data as 
they entered it.

The same for the social security number, accept with and without the 
dash, and if your backend needs it with a dash, then format it with a 
dash when its missing just prior to storing the information in the database.

The idea is to be flexible with what's being entered - parse it, and if 
it makes sense, store it. If it doesn't make sense, then send it back to 
the user.
Received on Sunday, 2 November 2008 10:42:18 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 13 October 2015 16:21:38 UTC