开发者

How to "chain" modal dialogs in YUI 2?

开发者 https://www.devze.com 2022-12-24 12:50 出处:网络
I have a modal dialog box presented in Yahoo UI. The user selects a value from dialog \"A\", and then I want to present another modal dialog box to collect some more data in dialog \"B\".

I have a modal dialog box presented in Yahoo UI. The user selects a value from dialog "A", and then I want to present another modal dialog box to collect some more data in dialog "B".

I have been using the YAHOO.widget.Dialog successfully. The problem seems to be that you can't initiate dialog window "B" from the handler function of dialog "A". So, how can you programmatically launch 开发者_C百科a second dialog window after the user hits the "OK" button on the first ?

(I had tried to create an additional Listener for a field that is updated in dialog "A" to trigger dialog "B" but this doesn't work either.)

Thanks..


Check out the documentation: http://developer.yahoo.com/yui/container/dialog/#events. The following code should do the trick:

var firstDialog = new YAHOO.widget.Dialog('firstDialog', { postmethod: "manual" });

firstDialog.manualSubmitEvent.subscribe(function (type, args) {

    var nextDialog = new YAHOO.widget.Dialog('nextDialog', {  });

    /* more configuration stuff... */

    nextDialog.render();
    nextDialog.show();

});

firstDialog.render();
firstDialog.show();

This handles when the form is to be submitted, which I think what you mean by selects a value, but if not let me know and I can give some help on that situation.

0

精彩评论

暂无评论...
验证码 换一张
取 消