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

Client side yiiActiveForm('validate') #6160

Closed
leandrogehlen opened this issue Nov 21, 2014 · 8 comments
Closed

Client side yiiActiveForm('validate') #6160

leandrogehlen opened this issue Nov 21, 2014 · 8 comments
Assignees
Labels
type:docs Documentation
Milestone

Comments

@leandrogehlen
Copy link
Contributor

Currently does not possible to invoke the method validate unless when i will submitting the form.

Ex:

if (('#myform').yiiActiveForm('validate')) {
    //busness logic
    $('#myform').submitForm();
}
@samdark samdark added this to the 2.0.x milestone Nov 21, 2014
@sebathi
Copy link
Contributor

sebathi commented Jun 17, 2015

+1

@samdark samdark modified the milestones: 2.0.5, 2.0.x Jun 17, 2015
@samdark samdark self-assigned this Jun 17, 2015
@Faryshta
Copy link
Contributor

also is there a way to be able to do single attributes validations using js?

I am trying to make a form with this http://vadimg.com/twitter-bootstrap-wizard-example/ right now i am stuck that I need to trigger js validation of the fields when I switch steps which as @leandrogehlen said, is only possible when the form is submitted.

@samdark
Copy link
Member

samdark commented Jul 7, 2015

@Faryshta yes.

$('form').yiiActiveForm('validateAttribute', 'contactform-name')`.

@samdark
Copy link
Member

samdark commented Jul 7, 2015

#1422

@samdark
Copy link
Member

samdark commented Jul 7, 2015

@samdark
Copy link
Member

samdark commented Jul 7, 2015

$('#contact-form').data('yiiActiveForm').submitting = true;
$('#contact-form').yiiActiveForm('validate');

@samdark samdark removed this from the 2.0.5 milestone Jul 7, 2015
@samdark samdark added type:docs Documentation and removed type:enhancement labels Jul 7, 2015
@cyanoboy
Copy link

cyanoboy commented Jul 9, 2015

@samdark how can I know if validation manually triggered returns errors? I'm developing a wizard in which a form is divided in steps and every time the "next" button is clicked I need to trigger validation and change step only if no validation errors occurs.
With

$('form').yiiActiveForm('validateAttribute', 'contactform-name')

I can't control validation result.

@Faryshta
Copy link
Contributor

@cyanoboy i am doing the same. Chofoteddy/yii2-bootstrap-wizard#4

@SilverFire SilverFire added this to the 2.0.9 milestone May 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:docs Documentation
Projects
None yet
Development

No branches or pull requests

6 participants