Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery form Validate wouldn't work using tabs in page

So basically I have a simple POST form that is being validated using Validate library from jquery, and it all works fine, but then I used the tabs function from bootstrap and many other libraries to separate the form into two different tabs. The problem now is that validation happens only to the open (visible) tab, regardless the condition of the other input fields in hidden tabs. Any possible suggestions?

like image 802
Khaled Avatar asked Oct 17 '12 06:10

Khaled


1 Answers

I think your trouble might be that jquery by default will only validate visible fields. So what you need to do is tell jquery to not ignore your hidden fields (other tabs). This can be done as follows:

$("#form1").validate({
    ignore: ""
});

By default ignore: ":hidden".
See this answer, and this documentation (Options -> Ignore).

like image 110
Miika L. Avatar answered Nov 15 '22 18:11

Miika L.