views:

634

answers:

1

I have a YAHOO Panel object defined like this:

profilesDialog = new YAHOO.widget.Panel("profiles_dialog", {
            width: "705px",
            height: "609px",
            fixedcenter: "contained",
            close: true,
            draggable: true,
            zindex: 2,
            autofillheight: "body",
            visible: false,
            constraintoviewport: true,
            modal: true,
            zIndex: 1000
        });

The "close: true" section of the config causes the little close button to be rendered in the panel. When you click on this little button the panel is hidden.

Now I know that I can subscribe to the "beforeHideEvent" and that is desirable but what I want to know is if some conditions are met inside this "beforeHideEvent" how do I stop the panel from firing its own close method.

Thank you for the help.

Daniel

A: 

inside the subscribed function to beforeHideEvent:

YAHOO.util.Event.preventDefault(event);

and, if you want to stop the event bubling up to other non-default events:

stopPropagation(event)

http://developer.yahoo.com/yui/docs/YAHOO.util.Event.html#method_stopPropagation

also, there's an

stopEvent(event)

that's a sum of stopPropagation + preventDefault.

gcb