Hi Felix,
thank you for your answer.
However, I already tried your solution but I have the following behavior.
When I press OK everytime it close my windows, however, I would like to
close the windows only in onSuccess or when cancel is pressed.
Thank you
On 12/26/06, Felix Shnir <[EMAIL PROTECTED]> wrote:
Not from Ajax object, from the ok function. Ultimately, ok is what
closes dialogs. so if your ok returns true, then the dialog will close upon
pressing OK button.
Alternatively, you can do Windows.close(null, 'dialog_id'); -- this is a
dirtier way. Another way is to grab a hold of dialog object and do
.destroy() on it -- this is also not recommended.
So, in your code:
Dialog.confirm($('login').innerHTML,
{windowParameters: {className: "alphacube", width:380, height:170},
okLabel: "login", cancelLabel: "cancel",
ok:function(win){
xhr=new Ajax.Request('/cambia_pwd.php',
{
method:'post', asynchronous:true,
evalScripts:true,
onLoading:function(request){Element.show('_spinner');},
onComplete:function(request){Element.hide('_spinner');},
onSuccess:function(request){ Element.hide
('_spinner');win.closeInfo();},
on404: function(t) {
Element.show('_error');
document.getElementById('_error').innerHTML="Verifica
le password e ricordati che la lunghezza minima e 4 caratteri";
Element.hide('_spinner');
return false;
},
postBody:'vecchia_pwd='+escape($F('vecchia_pwd'))+'&nuova_pwd='+escape($F('nuova_pwd'))+'&redigit_pwd='+escape($F('redigit_pwd'))
});
return true;
}
});
Felix.
On 12/26/06, Il Neofita < [EMAIL PROTECTED]> wrote:
>
> I need to return true or false from Ajax.request , however, I do not
> know how.
>
>
> On 12/26/06, Felix Shnir < [EMAIL PROTECTED] > wrote:
> >
> > You need to return true or false in the ok function. Returning true
> > will close your window.
> >
> > Felix.
> >
> >
> >
> > On 12/26/06, Il Neofita < [EMAIL PROTECTED]> wrote:
> >
> > > This is my code, I am wondering how I can close the window on
> > > Success
> > >
> > > Thx
> > >
> > >
> > > Dialog.confirm($('login').innerHTML,
> > > {windowParameters: {className: "alphacube", width:380,
> > > height:170},
> > > okLabel: "login", cancelLabel: "cancel",
> > > ok:function(win){
> > > xhr=new Ajax.Request('/cambia_pwd.php',
> > > {
> > > method:'post', asynchronous:true,
> > > evalScripts:true,
> > > onLoading:function(request){Element.show
> > > ('_spinner');},
> > > onComplete:function(request){Element.hide
> > > ('_spinner');},
> > > onSuccess:function(request){ Element.hide
> > > ('_spinner');win.closeInfo();},
> > > on404: function(t) {
> > > Element.show('_error');
> > >
document.getElementById('_error').innerHTML="Verifica
> > > le password e ricordati che la lunghezza minima e 4 caratteri";
> > > Element.hide('_spinner');
> > > return false;
> > > },
> > >
> > >
postBody:'vecchia_pwd='+escape($F('vecchia_pwd'))+'&nuova_pwd='+escape($F('nuova_pwd'))+'&redigit_pwd='+escape($F('redigit_pwd'))
> > >
> > > });
> > > }
> > > });
> > >
> > >
> > >
> > > _______________________________________________
> > > Javawin mailing list
> > > [email protected]
> > > http://mail.xilinus.com/mailman/listinfo/javawin_xilinus.com
> > >
> > >
> > >
> >
> >
> > --
> > Felix
> > -------------------------
> > God put me on earth to accomplish a certain number of things. Right
> > now, I'm so far behind, I will never die...
> > _______________________________________________
> > Javawin mailing list
> > [email protected]
> > http://mail.xilinus.com/mailman/listinfo/javawin_xilinus.com
> >
> >
> >
>
> _______________________________________________
> Javawin mailing list
> [email protected]
> http://mail.xilinus.com/mailman/listinfo/javawin_xilinus.com
>
>
>
--
Felix
-------------------------
God put me on earth to accomplish a certain number of things. Right now,
I'm so far behind, I will never die...
_______________________________________________
Javawin mailing list
[email protected]
http://mail.xilinus.com/mailman/listinfo/javawin_xilinus.com
_______________________________________________
Javawin mailing list
[email protected]
http://mail.xilinus.com/mailman/listinfo/javawin_xilinus.com