You code is missing a comma after each rule On Tue, Sep 22, 2009 at 10:34, Dakuwan <daku...@gmail.com> wrote:
> > Tracked it down to the rules area, there was an unclosed }. > > On Sep 21, 4:47 pm, Dakuwan <daku...@gmail.com> wrote: > > I am having the following issue, when I try using an image to post I > > cannot get the validation to run. When I click the button the form > > submits and nothing is checked. I've been searching all over the web > > and cant find any help. One way of coding doesnt work and the other > > does. I have included both below. I'd really appreciate the help. > > > > This code doesnt work: > > $().ready(function() { > > > > var container = $('div.container'); > > > > var validator = $("#CustForm").validate({ > > errorContainer: container, > > wrapper: 'li', > > meta: "validate", > > rules: { > > credit_card: { > > required: function(element) { > > return $("#payment_type").val() > == 'credit' > > } > > } > > card_month: { > > required: function(element) { > > return $("#payment_type").val() > == 'credit' > > } > > } > > card_year: { > > required: function(element) { > > return $("#payment_type").val() > == 'credit' > > } > > } > > card_number_ccard: { > > required: function(element) { > > return $("#payment_type").val() > == 'credit' > > } > > } > > > > } > > }); > > > > $('#CustForm input:image#nextButton').click(function() { > > return $('CustForm').valid(); > > }); > > > > }); > > > > If I do this however it does work. I have to have the rules run > > because based on the payment type selected certain fields become > > required. > > > > $().ready(function() { > > > > var container = $('div.container'); > > > > var validator = $("#CustForm").validate(); > > > > $('#CustForm input:image#nextButton').click(function() { > > return $('CustForm').valid(); > > }); > > > > }); > > > > This is my button code: > > <cfinput type="image" src="nextstep.gif" value="submit" > > name="nextButton" id="nextButton" border=0 class="submit"> > > > > Thanks for the help. >