Hi there,
I've came to following situation:
- i have form (person information) with multiple contacts (phones / emails)
- i'm using FormsReplicator to render contacts
- there are multiple submit buttons
general
submit buttonadd
contact buttonremove
contact button (multiple)
Is there some way to disable transition when form is submitted by add
or remove
contact btns, but let transition work when form is submitted by general
submit button?
Hi @Yess, well, there is a way, but it ain't easy.. Nittro currently doesn't have any way of altering transaction behaviour via data attributes of the submit buttons of forms - only the data attributes of the form element itself. I think the easiest way to do this would be to listen for the click event on all the submit buttons and then setting the data-transition
attribute in the handler, something like this (should be placed within the same snippet as the <form>
element; assuming the submit buttons all share the class btn
):
<script type="application/javascript">
_stack.push([function(di, DOM) {
di.getService('page').getSnippet({form.id myForm}).setup(function(form) {
DOM.addListener(form, 'click', DOM.delegate('.btn', function(evt, btn) {
if (btn.value === 'general') {
form.removeAttribute('data-transition');
} else {
form.setAttribute('data-transition', 'false');
}
}));
});
}, {
DOM: 'Utils.DOM'
}]);
</script>
Sign in to post a reply