MochaUI modal dialog form submit
Posted
by VP
on Stack Overflow
See other posts from Stack Overflow
or by VP
Published on 2010-06-01T14:48:56Z
Indexed on
2010/06/01
14:53 UTC
Read the original article
Hit count: 1085
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.
© Stack Overflow or respective owner