The $AddMaskDefinition really adds a lot of flexibility to the
plugin.  It allows you to do a lot of user form validation character
by character.  For example, if I wanted to have an input that only
accepted a signed integers with decimal quarters  (like +4.75 or
-1.50, for the sphere reading in eyeglass prescriptions), I could
declare 3 different AddMasks:
$.AddMaskDefinition('~','[+-]');
$.AddMaskDefinition('^','[05]');
$.AddMaskDefinition('@','[0257]')
then in document.ready(): $("input.sphere").maskedinput("[EMAIL PROTECTED]");

In fact, I already have quite a list of custom charMaps, so I thought
it may be more efficient to make one call and pass an array to the
$.AddMaskDefinition.  I replaced your code with
$.AddMaskDefinition=function(mapArray){
     while (mapArray.length > 0){
          var c = mapArray.shift();
         charMap[c] = mapArray.shift();
     }

So I can pass declare all my charMaps at once:

$.AddMaskDefinition(['~','[+-]','^','[05]','@','[0257]']);

Whaddya think?




On Jun 29, 11:12 am, Josh Bush <[EMAIL PROTECTED]> wrote:
> I looked into this more last night and it looks like I can't cancel
> that the Esc keypress (in FF).  The best it looks like I'll be able to
> do if wipe the buffer so that when the user starts typing again
> phantom characters don't start appearing (Queue spooky music).
>
> On Jun 28, 1:17 am, "Gilles (Webunity)" <[EMAIL PROTECTED]> wrote:
>
>
>
> > Nice! However, when you see the mask and press "ESC" the mask also
> > disappears ;)
>
> > On 28 jun, 03:21, Josh Bush <[EMAIL PROTECTED]> wrote:
>
> > > Hey there, I'm back at it trying to push to a 1.0 release.  I made
> > > some code changes, so I would like some verification that all is well
> > > before I move this to a v1.0 status.
>
> > > The following is a list of changes for this release.
> > >  * Now supports user defined placeholder characters by calling
> > > "$.AddMaskDefinition(char,regex)" .  There is an example on my site.
> > >  * Fixed a bug where backspace from the first character position
> > > deleted the mask.
> > >  * General code cleanup.
>
> > > Please check it out at:http://digitalbush.com/projects/masked-input-plugin
> > > orhttp://jquery.com/plugins/project/maskedinput- Hide quoted text -
>
> - Show quoted text -

Reply via email to