Loading ...
Sorry, an error occurred while loading the content.

Make SimpleDialog behave like javascript confirm()

Expand Messages
  • themidnightwill
    Hello, I ve been experimenting with YUI, and love it. Recently, I ve been trying to devise a way to use a SimpleDialog like a JavaScript confirm() dialog box.
    Message 1 of 3 , Jun 1, 2006
    • 0 Attachment
      Hello,


      I've been experimenting with YUI, and love it.

      Recently, I've been trying to devise a way to use a SimpleDialog like
      a JavaScript confirm() dialog box. I realize it might be overkill to
      use the YUI in replacement, but hey, YUI is cool.

      I'd like to have a way to do:

      <a href="http://www.yahoo.com" onclick="return
      confirm_simpledialog()">Yahoo!</a>

      My problem lies in a way to return true or false. It seems to me, my
      confirm_simpledialog() function above would be coded something like this:

      function confirm_simpledialog()
      {
      mydialog.show();


      return some_var;
      }


      How could I set some_var from within the handler function for the
      SimpleDialog buttons?

      Any advice would be greatly appreciated!

      -Will
    • Matt Warden
      themidnightwill, ... Yahoo! Instead, create a dialog, and in your Yes handler, include: window.location =
      Message 2 of 3 , Jun 1, 2006
      • 0 Attachment
        themidnightwill,

        On 6/1/06, themidnightwill <scanomatic@...> wrote:
        > <a href="http://www.yahoo.com" onclick="return
        > confirm_simpledialog()">Yahoo!</a>

        <a href="#" onclick="confirm_simpledialog()">Yahoo!</a>

        Instead, create a dialog, and in your 'Yes' handler, include:

        window.location = 'http://yahoo.com';

        --
        Matt Warden
        Oxford, OH, USA
        http://mattwarden.com


        This email proudly and graciously contributes to entropy.
      • themidnightwill
        Matt, Thanks for the response. I had thought of something similar, but my issue with it was hard coding the URL into the function. I d like to be able to pass
        Message 3 of 3 , Jun 1, 2006
        • 0 Attachment
          Matt,

          Thanks for the response.

          I had thought of something similar, but my issue with it was hard
          coding the URL into the function. I'd like to be able to pass it an
          url - is there a way to pass this url as a variable to the
          SimpleDialog for use in the handler? Maybe even set a new handler
          right before doing myDialog.show()?

          Thanks again,

          -Will

          --- In ydn-javascript@yahoogroups.com, "Matt Warden" <mwarden@...> wrote:
          >
          > themidnightwill,
          >
          > On 6/1/06, themidnightwill <scanomatic@...> wrote:
          > > <a href="http://www.yahoo.com" onclick="return
          > > confirm_simpledialog()">Yahoo!</a>
          >
          > <a href="#" onclick="confirm_simpledialog()">Yahoo!</a>
          >
          > Instead, create a dialog, and in your 'Yes' handler, include:
          >
          > window.location = 'http://yahoo.com';
          >
          > --
          > Matt Warden
          > Oxford, OH, USA
          > http://mattwarden.com
          >
          >
          > This email proudly and graciously contributes to entropy.
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.