Flipper
Flipper

Reputation: 1107

Zurb Foundation show modal after validation

I'm using Foundation in my project. When the form is submitted, modal is opened with some message. I want to open modal if validation is ok. How to achieve this? I've tried adding attributes data-reveal etc. but nothing is happening.

Upvotes: 0

Views: 190

Answers (1)

Ethaan
Ethaan

Reputation: 11376

For the modales use this awesome package peppelg:bootstrap-3-modal.

HTML

<template name="exampleModal">
<!-- Modal Stuff -->
</template>

So this is how our validation will look

JS

Template.example.rendered = function(){
$('#myForm')
      .on('invalid.fndtn.abide', function () {
        var invalid_fields = $(this).find('[data-invalid]');
        console.log(invalid_fields);
      })
      .on('valid.fndtn.abide', function () {
            Modal.show('exampleModal') //on valid we show the modal super easy
      });
}

Upvotes: 1

Related Questions