Adam,
On Fri, Apr 21, 2006 at 11:40:00PM +0200, Adam B. wrote:
Nevermind. That was a really dumb question. 
Actually I’ve often heard that the only dumb questions are the ones not
asked. I neglected to post links to the scripts because, as I said,
they
have a few quirks that I’m not completely happy with. In fact, I’ve
already
had to apply a couple of patches that I found in a JavaScript forum to
the
dFilter script. With the original script when one enters numbers via
the
numeric keypad they show up as letters instead of numbers. The first
patch
corrects that problem. The other patch keeps the mask characters from
showing up until one types past the spot where the mask characters
should
be. I’m not completely happy with that patch. I think the mask
charcters
should be showing up one keystroke sooner than they are. If you would
like
to try the script with the patches I mentioned above applied you can get
the
patched version at:
http://www.RawFedDogs.net/MaskAutoTab.tgz
I put both the dFilter and autoTab scripts in the archive, although I
haven’t
made any changes to the autoTab script.
However, it’s not currently working. 
Are you sure?
I get the automatic parens and dashes, but there’s only one text field,
and it tabs to the next field (e-mail address) when I’ve typed 10 numbers.
It sounds like it’s working to me. That’s exactly what it’s supposed to
do.
The masked input script doesn’t create separate entry fields for the
various
parts of a phone number, date, etc. All parts of the phone number,
date, etc.,
are entered into one field and the script fills in the mask characters
in the
appropriate spots. For example, for a date entry field one could use:
<%= masked_auto_tab_text_field ‘event’, ‘start_date’, ‘##/##/####’ %>
That would create one field. A user could enter:
04212006
and it would appear in the field as:
04/21/2006
The user didn’t have to type the slashes, only the numbers.
If you want to have separate fields you could use the autoTab script by
itself. Perhaps a helper similar to:
def auto_tab_text_field(object, method, length, options = {})
options[“onKeyUp”] = "return autoTab(this, " +
length.to_s + “, event);”
options[“size”] = length.to_s
text_field(object, method, options)
end
then in your template(using a phone number as an example):
Phone Number: (<%= auto_tab_text_field ‘phone’, ‘area_code’, 3 -%>
)<%= auto_tab_text_field ‘phone’, ‘exchange’, 3 -%>
-<%= auto_tab_text_field ‘phone’, ‘number’, 4 %>
might achieve what you’re looking for. Of course, as others have said,
you
would then have to piece the phone number together from the three form
fields. Personally I prefer using a single field. That’s one of the
things
I’m really beginning to appreciate about Rails. It’s so easy to add
form
helpers and make forms work just the way I want them to work, while
keeping
my templates neat and tidy.
Kevin
http://www.RawFedDogs.net
http://www.WacoAgilityGroup.org
Bruceville, TX