John Resig schrieb:
>> phone number mask.
>> I think this would make a great jQuery plugin.  It has the right pieces of
>> the puzzle.  Example:
>> <input type="text" jMask="###-###-####">
>>
>> Works as a great constraint to keep data in the correct format.
>> I have no idea how to port this into a plugin.  I am really not that good of
>> a programmer. I am an interaction designer.
>> Any suggestions?
>>     
> Here is a question: On the form validation example, take a look at the
>
> You should check out this form validation plugin:
> http://fuzz.bassistance.de/jQueryFormValidation/validateTest.html
>
> I think it'll handle what you're looking for
You could add a validation rule that takes the pattern as a parameter, 
something like this:
(function() {
    var match = function(value, pattern) {
        // matching code here
    };
    jQuery.validator.rules.pattern = function(value, element, params) {
        return match(value, pattern);
    };
})();

And the using it like this:
<input validate="pattern:###-###-##" />

-- Jörn

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to