简体   繁体   中英

Form To Wizard and Zurb Foundation Abide Validation

I am using Form To Wizard to create a multi page form (each fieldset is a separate page). I'm also using Foundation Abide Validation to validate my forms, however I am having trouble getting the two to work together.

The formToWizard has a "validateBeforeNext" function that I should be able to use to trigger Abide Validation, but how do I get Abide to only validate the current fieldset and not let the user progress until the current page is correctly filled out?

For anyone who stumbles on this and has the same issue, I finally figured it out.

You need to use the Foundation.libs.abide.parse_patterns() function and pass through a list of all of the elements that you want validated. So basically your formToWizard call looks like this:

    $("#signup_form").formToWizard({ 
        submitButton: 'SaveAccount',
        showProgress: true,
        showStepNo: false,
        validateBeforeNext: function() {
            return Foundation.libs.abide.parse_patterns($('.signup_form_fieldset:visible').find(':input[required]'))[0];                   
        }
    });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM