MochaUI modal dialog form submit
- by VP
Hi, i'm playing with Motools + MochaUI and i'm facing a problem:
I'm trying to submit a form from a modal window. It is working fine, the problem is that it is reloading the parent window.
The code to my Modal:
MUI.newPolicyWindow = function(){
new MUI.Modal({
id: 'modalNewPolicy',
title: 'New Policy',
contentURL: '/policies/new',
type: 'modal',
width: 340,
height: 180,
scrollbars: false
});
}
And my js to handle the action (the form's name is new_policy
$('new_policy').addEvent('submit', function(e){
new Event(e).stop();
this.set('send', {onComplete: function(response) {
MochaUI.notification('Policy created');
MUI.closeAll();
}});
this.send()
});
Note that the form is submitted, the problem is that i would like that, on Success, it just close my Modal and send this Mocha's cute notification.