Reputation: 142
Using autoform I am trying to create a modal that will dismiss on submit only if the fields are valid. If the fields are not valid I do not want the modal to dismiss. In the format shown below it will always dismiss even when the values are not valid.
<template name="insertForm">
{{#autoForm schema=schema id="insertForm" type="method" meteormethod="newC"}}
<fieldset>
{{> afQuickField name="Name"}}
{{> afQuickField name="Stuff"}}
<button type="submit" class="btn btn-primary" data-target="#formModal" data-toggle="modal">Submit</button>
</fieldset>
{{/autoForm}}
</template>
Upvotes: 0
Views: 813
Reputation: 552
Use Hook to do this. this sample code may help you to understand :
var insertFormhook = {
onSuccess: function(update, result) {
if(result){
// ...
Modal.hide('insertForm');
}
}
}
AutoForm.addHooks('insertForm',insertFormhook);
Basically i am using peppelg:bootstrap-3-modal which gives me easy to use bootstrap 3 modals.
Cheers...
Upvotes: 1