I tried writing a test function that just calls the existing function so it should give the same results.
jQuery.validator.addMethod ('ccard', function (value, elem) { return (jQuery.validator.methods.creditcard (value, elem)); }, 'Enter a valid credit card number'); Unfortunately it didn't work, it just caused firebug to log an error. "this.optional is not a function" On May 15, 3:21 pm, "Jörn Zaefferer" <[EMAIL PROTECTED]> wrote: > You can access the built-in method directly via > jQuery.validator.methods.creditcard. You have to provide two > arguments, the current value and the element to validate. > > var element = $(...)[0]; > if (jQuery.validator.methods.creditcard(element.value, element)) > // valid > else > // invalid > > Jörn > > On Thu, May 15, 2008 at 4:14 PM, Gordon <[EMAIL PROTECTED]> wrote: > > > I want to extend the provided cxreditcard method to count a sequence > > of * characters followed by 4 digits as a valid value. I need this for > > a form where the credit card can be populated from a previously saved > > value. Naturally we don't want to display the full number for > > security reasons but we need for the user to be able to see the last > > four digits. > > > My idea was to write a new ccard method that calls the pre-existing > > creditcard method. If that method returns true then return true. If > > it returns false then check the field value against a regex /\*+[0-9] > > {4,4}/. > > > How can I write a custom method that makes use of a built in > > method?