Yeah I agree with Jörn. It looks like an $().unmaskedinput() would be
nice for this case. I just tried to call $().maskedinput() to
overwrite the current mask but it doesn't do that very well. You could
just replace the input onChange of ccType. Some psuedo code
illustrate.
onChange:
if ccType == AMEX
#ccNum remove
body append <input type="text" name="ccNum">
maskedInput
I wouldn't keep several inputs in the form because that wouldn't make
much sense for when JS and or CSS is not applicable. However using JS
to enhance the usability of the form is game. Hope that helps.
--
Brandon Aaron
On 5/23/07, Jörn Zaefferer <[EMAIL PROTECTED]> wrote:
Glen Lipka wrote:
> Im asking alot of questions today, sorry.
>
> Trying to use this.
> http://digitalbush.com/projects/masked-input-plugin
> It is an awesome plugin by the way!
>
> I have one field called creditcard (guess what goes in there)
> And another select called credtcardType (amex, visa, mc, discover)
>
> I want to put in the spaces like this 9999 9999 9999 9999.
> But for Amex I want 9999 999999 99999.
> Ultimately, I want to submit to the server without spaces. (Maybe a
> hidden form field)
>
> How should I achieve this?
>
> Posibility #1: Have different fields for each credit card type and
> show/hide them based on the ccType select.
>
> Possibility #2: onChange of the select, change the class of the input
> and then re-apply the mask with an if statement which reads the class
> and applies the correct mask.
> Totally unsure how to do this.
>
> Possibility #3: Pray
In case you don't find a good soltion, just contact Josh directly. It
seems like his plugin didn't get the attention yet that it deserves,
therefore there may be quite some potential for improvements. He added
the ability to paste both unformatted and formatted values after I asked
for it.
--
Jörn Zaefferer
http://bassistance.de