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

How to check with ajax? #323

Open
iwasherefirst2 opened this issue Feb 16, 2021 · 0 comments
Open

How to check with ajax? #323

iwasherefirst2 opened this issue Feb 16, 2021 · 0 comments

Comments

@iwasherefirst2
Copy link

This seems to be a duplicate of #234 but I don't understand the solution there.

When I call onStepChanging then an external api call is made (whenValidate returns a jquery promise). For synchronize calls this method works because I can just return true/false, but what do I have to do when I have a asynchronous call?

 $(".steps-validation").steps({
        headerTag: "h6",
        bodyTag: "fieldset",
        transitionEffect: "fade",
        titleTemplate: '<span class="number">#index#</span> #title#',
        autoFocus: true,
        enableFinishButton: false,
        onStepChanging: function (event, currentIndex, newIndex) {

            // Allways allow previous action even if the current form is not valid!
            if (currentIndex > newIndex) {
                return true;
            }
           
            var validateForm = form.parsley().whenValidate({
                group: 'block-' + currentIndex
            });
            
            validateForm.then(function () { 
                  // CONTINUE HERE WITH NEXT STEP
                  $("#wizard").steps("next",{}); 
            

            }, function () { console.log('oh no..');});
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

1 participant