You can do a deep extend - its still undocumented, but stable since 1.2.6:

$.extend(true, validationOptions, { rules: { email: { required: true } } });

Jörn

On Sun, May 25, 2008 at 6:25 PM, Doug Mayer <[EMAIL PROTECTED]> wrote:
>
> Trying to implement this now... Working off of what you said, is there
> a way to do something like this?
>
> var validationOptions = { rules: { name: { required: true } } };
>
> $.extend(validationOptions, { rules: { email: { required: true } } });
>
> And get a validationOptions with both?  Or will I need to keep
> iterating over everything and merging each individually?
>
> On May 25, 7:54 am, "Jörn Zaefferer" <[EMAIL PROTECTED]>
> wrote:
>> I don't yet have a good idea of your setup, so just a quick idea:
>>
>> // somewhere before the other stuff
>> var validationOptions = {};
>>
>> // set page specifc options
>> $.extend(validationOptions, { ... });
>>
>> // generated
>> $(...).validate(validationOptions);
>>
>> That would work with and without page-specific code.
>>
>> Jörn
>>
>> On Sun, May 25, 2008 at 5:36 AM, Doug Mayer <[EMAIL PROTECTED]> wrote:
>>
>> > I'm working on an ASP.NET validation integration with jQuery, and
>> > there are some things that inherently don't fit with how I'm defining
>> > my validation.  There are some things like required with dependency
>> > expression and callbacks that are easier to ignore and define in the
>> > page yourself.
>>
>> > My project (which I'll be releasing as open-source) automatically
>> > generates the $("#formId").validate() method, and redefining it
>> > elsewhere causes problems.  Is there a way to define it more than
>> > once, but allow them to complement each other without overriding
>> > (assuming there will be no conflicts)?
>>
>> > Thanks,
>> > Doug
>

Reply via email to