Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$("form").valid() with jQuery UI tabs no longer works #334

Closed
leniel opened this issue Mar 14, 2012 · 8 comments
Closed

$("form").valid() with jQuery UI tabs no longer works #334

leniel opened this issue Mar 14, 2012 · 8 comments

Comments

@leniel
Copy link

leniel commented Mar 14, 2012

I'm using ASP.NET MVC 4 and just updated to version 1.9.0.

In one of my views I have 5 tabs using jQuery UI tabs...

One field that needs to be validated is on the 4th tab and it's in an invalid state.

When I click the submit button and all fields on the 1st tab are valid, the form gets submitted despite the invalid field in 4th tab. It shouldn't.

The code is working great with jQuery Validation Plugin 1.8.0. I had to revert to this version! :)

This is the code I use:

$("#save-button").bind('click', function ()
{  
     if (!$("form").valid())
     {
          $("#tabs").tabs("select", $("form .input-validation-error").closest(".ui-tabs-panel").get(0).id);

          $("form.input-validation-error").focus();
     }

     $("form").submit();
});
@jzaefferer
Copy link
Collaborator

Since 1.9, :hidden elements are ignored by default, see #189.

You can get the old behaviour back by setting ignore: []. Let me know if that works for you.

@leniel
Copy link
Author

leniel commented Mar 16, 2012

@jzaefferer It worked. Thanks! I used the solution provided here: #279 (comment)

$.validator.setDefaults({
    ignore: ""
});

@leniel leniel closed this as completed Mar 16, 2012
@ctsears
Copy link

ctsears commented May 17, 2012

Adding "ignore: []" works on a case-by-case basis, but it shouldn't be necessary. The burden is now on the developer to override the default behavior in all situations that a required field might be (or become) hidden. The burden should be on those who want to ignore hidden fields.

@danigit001
Copy link

Worked for me too

$.validator.setDefaults({
    ignore: ""
});

@DRent
Copy link

DRent commented Jun 12, 2013

its not working for me..is any other way to do it?

@michaelthecsguy
Copy link

It does not work with me neither with that solution.

@glaucomorais
Copy link

Sorry about for bump up this again, but it's not working neither adding $.validator.setDefaults({ ignore: '' }); or adding ignore option on .validate().

I'm using jQuery 2.0.3 and validator 1.11.1.

@jzaefferer
Copy link
Collaborator

If you have a similar issue, please put together a test page using jsfiddle or jsbin. Also a post on the forum or StackOverflow is going to be more helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants