You assume that equalTo is a jQuery method (or plugin method), which
isn't the case. Look at the source for equalTo to get an idea how to
implement your own.

Jörn

On Sun, Mar 22, 2009 at 11:56 PM, linoj <lino...@gmail.com> wrote:
>
> fyi, this is what i've tried, but it doesnt work :/
>
>    $.validator.addMethod("confirm", function(value, element) {
>      var other = $(this).attr("id").replace("_confirm","");
>      $(this).equalTo(other);
>    }, "does not match");
>
>
>
> On Mar 22, 8:56 am, Jörn Zaefferer <joern.zaeffe...@googlemail.com>
> wrote:
>> Give equalTo a try:http://docs.jquery.com/Plugins/Validation/Methods/equalTo
>>
>> Jörn
>>
>> On Sun, Mar 22, 2009 at 7:30 AM, linojon <lino...@gmail.com> wrote:
>>
>> > Hi
>>
>> > Using thevalidateplugin, I'd like to write a validation method
>> > called "confirm" that does the following:
>>
>> > suppose my form has
>> >        <input type="text" id="email" class="required email">
>> >        <input type="text" id="email_confirm" class="required email 
>> > confirm">
>>
>> > what I'd like is the confirm method to look at the current object's
>> > id, strip off the "_confirm" and check that the value matches the
>> > corresponding field. I'd like this to be reusable.
>>
>> > I've made several attempts at this but...
>>
>> > thanks
>>
>> > linoj

Reply via email to