The validation plugin requires name-attributes on your inputs. Thats what "rules" is referring to.
Jörn On Thu, Apr 30, 2009 at 11:35 PM, Gary Brunton <[email protected]> wrote: > > Given this form and elements: > > <form id="aspnetForm" action="#"> > <input type="text" id="nameInputId" /> > <input type="text" id="abbreviationInputId" /> > </form> > > > I cannot get the following test to pass > > > $(document).ready(function() { > test("testing validation", function() { > // arrange > $("#nameInputId").val(""); > $("#abbreviationInputId").val("not empty"); > > // act > $("#aspnetForm").validate(); > $("#abbreviationInputId").rules("add", { required: true }); > > var rules = $("#nameInputId").rules(); > > // assert > expect(4); > equals(rules.required, null); > equals($("#aspnetForm").validate().element("#nameInputId"), true); > equals($("#aspnetForm").validate().element > ("#abbreviationInputId"), true); > equals($("#aspnetForm").valid(), true); > }); > }); > > > I'm using Qunit version: jqueryjs - Revision 6323: /trunk/qunit > jquery version jquery-1.3.2.min.js > jquery plugin: Validation v1.5.2 > > For some reason, although I am specifically adding the required method > to > the abbreviationInput element it is also being added to the nameInput > element. > At first I thought the problem was with the validation plugin but this > actually > works as expected when not using Qunit. > > Any thoughts or insight would be very appreciated. > > Thanks! > Gary Brunton > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---
