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

Trigger js form validation when the 'next' button is clicked #4

Open
Faryshta opened this issue Jul 10, 2015 · 4 comments
Open

Trigger js form validation when the 'next' button is clicked #4

Faryshta opened this issue Jul 10, 2015 · 4 comments

Comments

@Faryshta
Copy link
Contributor

a way I found to do it would be

$('.tab-button').click(function () {
  $(this).parent('.tab-content')
    .find('.form-group').
    .trigger('blur.yiiActiveForm');
});

But I can't get a return to know if there is any invalid field and it feels hacky

@PrplHaz4
Copy link

The solution I came up with was to look for .has-error classes - which is, obviously, additionally hacky...

@Faryshta
Copy link
Contributor Author

@Chofoteddy what do you think?

@cyanoboy
Copy link

I solved the problem intercepting validation event afterValidateAttribute. I check if the number of non-errors is equal to the number of fields I'm validating. In that case I can go to the next wizard step. Here is the description http://www.devbattles.com/en/discussion/view-943-Yii2,+how+to+run+a+validation+form+manually+and+get+a+result+#.VaDwGfntlBf

@Faryshta Faryshta added this to the 1.0 milestone Jul 14, 2015
@Faryshta
Copy link
Contributor Author

@cyanoboy can you make a PR?

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

No branches or pull requests

3 participants