With the 1.5 release you will be able to use this instead:

$("#myform").validate({
  rules: {
    username: {
      required: true,
      remote: {
        url: "checkusername.php",
        type: "post"
        data: {
          email: function() { return $("#email").val() }
        }
      }
    }
  }
});

In other words, you can override all settings that $.ajax supports by
replacing the current remote: "url" with remote: {url:"url"} and add
whatever you need.

You can try it out now
(http://jqueryjs.googlecode.com/svn/trunk/plugins/validate/) or wait
for the next release.

Feedback is welcome!

Jörn

On Sun, Nov 23, 2008 at 1:27 PM, Jörn Zaefferer
<[EMAIL PROTECTED]> wrote:
> Try this instead:
>
> $().ajaxSend(function(event, XMLHttpRequest, ajaxOptions) {
>  $.extend(ajaxOptions.data, {username: $("#Username").val()});
> });
>
> Jörn
>
> On Sun, Nov 23, 2008 at 2:17 AM, shapper <[EMAIL PROTECTED]> wrote:
>>
>> Hello,
>>
>> On a form I am remote validation for an email.
>> However, to this validation, I also need to provide the inserted
>> username which is on another text box.
>>
>> I am using the following:
>>
>> $().ajaxSend(function(event, XMLHttpRequest, ajaxOptions) {
>>  ajaxOptions.data.username = $("#Username").val();
>> });
>>
>> I get an error on Firebug saying:
>>
>> ajaxOptions.data is null
>> (?)()()Account.js (line 30)
>> handle()()JQuery%2...1.2.6).js (line 2093)
>> (?)()()JQuery%2...1.2.6).js (line 1875)
>> trigger()()JQuery%2...1.2.6).js (line 2034)
>> trigger()()JQuery%2...1.2.6).js (line 2267)
>> each()()JQuery%2...1.2.6).js (line 762)
>> each()()JQuery%2...1.2.6).js (line 155)
>> trigger()()JQuery%2...1.2.6).js (line 2266)
>> trigger()()JQuery%2...1.2.6).js (line 2002)
>> ajax()()JQuery%2...1.2.6).js (line 2748)
>> ajax()()Validate...0(1.4).js (line 1057)
>> remote()()Validate...0(1.4).js (line 902)
>> check()()Validate...0(1.4).js (line 468)
>> element()()Validate...0(1.4).js (line 321)
>> onfocusout()()Validate...0(1.4).js (line 214)
>> delegate()Validate...0(1.4).js (line 289)
>> delegate()()Validate...0(1.4).js (line 1097)
>> handle()()JQuery%2...1.2.6).js (line 2093)
>> handler()()Validate...0(1.4).js (line 1088)
>> [Break on this error] ajaxOptions.data.username = $("#Username").val
>> ();
>>
>> The input id is "Username". It is correct. I confirmed it!
>>
>> What am I doing wrong?
>>
>> And how can I add the username ONLY to this validate?
>>
>> I have one more request on the page and I don't want to add the
>> username also to it ...
>> ... I am afraid that I will get an error.
>>
>> I have been trying to solve this but I am stuck.
>>
>> Could someone please help me?
>>
>> Thanks,
>> Miguel
>>
>>
>

Reply via email to