Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Javascript synchronous Yes-No-Cancel dialog [modified]

Javascript synchronous Yes-No-Cancel dialog [modified]

Scheduled Pinned Locked Moved Web Development
javascripthelpquestion
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dimitri Witkowski
    wrote on last edited by
    #1

    Hello everyone! I'm implementing a javascript function that must show a modal dialog with Yes-No-Cancel buttons and return the selected value. I have found a workaround for IE, Firefox, Chrome and Safari (using window.showModalDialog). Does anyone know any solution for Opera? It doesn't support showModalDialog :mad: Or, as a variant, maybe there's any implementation of noop for Opera? (non CPU-intensive loop) The problem is that I can't show a modal dialog in such way:

    show(success: function() { ... });

    My function is called from external javascript component, and this component is expecting the result in synchronous way. Thanks in advance.

    Die Energie der Welt ist konstant. Die Entropie der Welt strebt einem Maximum zu.

    modified on Friday, June 18, 2010 4:02 PM

    T J 2 Replies Last reply
    0
    • D Dimitri Witkowski

      Hello everyone! I'm implementing a javascript function that must show a modal dialog with Yes-No-Cancel buttons and return the selected value. I have found a workaround for IE, Firefox, Chrome and Safari (using window.showModalDialog). Does anyone know any solution for Opera? It doesn't support showModalDialog :mad: Or, as a variant, maybe there's any implementation of noop for Opera? (non CPU-intensive loop) The problem is that I can't show a modal dialog in such way:

      show(success: function() { ... });

      My function is called from external javascript component, and this component is expecting the result in synchronous way. Thanks in advance.

      Die Energie der Welt ist konstant. Die Entropie der Welt strebt einem Maximum zu.

      modified on Friday, June 18, 2010 4:02 PM

      T Offline
      T Offline
      T M Gray
      wrote on last edited by
      #2

      showModalDialog is not part of any web standard. I would look into the way that the AJAXControlToolkit ModalPopupExtender does it by showing a div with a high z-index that covers the page and captures any events that would normally go to the items behind it. And noop usually means "no op" i.e. no operation performed/do nothing and has nothing to do with loops.

      D 1 Reply Last reply
      0
      • T T M Gray

        showModalDialog is not part of any web standard. I would look into the way that the AJAXControlToolkit ModalPopupExtender does it by showing a div with a high z-index that covers the page and captures any events that would normally go to the items behind it. And noop usually means "no op" i.e. no operation performed/do nothing and has nothing to do with loops.

        D Offline
        D Offline
        Dimitri Witkowski
        wrote on last edited by
        #3

        Yeah, you are right, showModalDialog is not a part of any web standard but it's supported by all web browsers. Furthermore, Opera tells this: typeof(window.showModalDialog) will be "function" But I don't understand how to use it in Opera Using a div with high z-index will be not acceptable because it will not allow to wait while the user clicks on it. Yeah, I know how to implement everything using div-s but the problem is that my function must be called from external JS-component and return the ansewer to it. The component's code cannot be changed. Yeah, I mean exactly non cpu-intensive no-operation, if it exists, this means that non cpu-intensive loop can be easily implemented. Please sorry me for inaccuracy.

        Die Energie der Welt ist konstant. Die Entropie der Welt strebt einem Maximum zu.

        1 Reply Last reply
        0
        • D Dimitri Witkowski

          Hello everyone! I'm implementing a javascript function that must show a modal dialog with Yes-No-Cancel buttons and return the selected value. I have found a workaround for IE, Firefox, Chrome and Safari (using window.showModalDialog). Does anyone know any solution for Opera? It doesn't support showModalDialog :mad: Or, as a variant, maybe there's any implementation of noop for Opera? (non CPU-intensive loop) The problem is that I can't show a modal dialog in such way:

          show(success: function() { ... });

          My function is called from external javascript component, and this component is expecting the result in synchronous way. Thanks in advance.

          Die Energie der Welt ist konstant. Die Entropie der Welt strebt einem Maximum zu.

          modified on Friday, June 18, 2010 4:02 PM

          J Offline
          J Offline
          Jayapal Chandran
          wrote on last edited by
          #4

          http://www.ericmmartin.com/projects/simplemodal-demos[^] try to use jquery. it will take just a single line of code to show a dialog box... after including its js file. if you want to do it of your own then you need to compromise all the web browsers and this will be taken care by jquery. a javascript frame work. of if you want to do it of your own... ready about z-index and opacity... the gimmick is display a transparent div with 100% height and 100% width with the z-index more than any existing element. for example this overlay div will have zindex as 95. then display your rectangle dialog which will contain all three buttons above the overlay div with zindex more than 95. now try to click apart from the dialog rectangle( on any hyperlinks). nothing happens. the overlay div receives the mouse clicks because it has occupied the complete screen. once you click any button in the dialog then make the overlay div to display none and hide the rectangle. the above link is just an example. use the last one. and there are more than this in the web... so chose the one which will suite your design. and here is another use full link... http://jquery.malsup.com/block/#demos[^] you can search the web like "jquery modal dialog" and try to use your own words...

          Today's Beautiful Moments are Tomorrow's Beautiful Memories

          D C 2 Replies Last reply
          0
          • J Jayapal Chandran

            http://www.ericmmartin.com/projects/simplemodal-demos[^] try to use jquery. it will take just a single line of code to show a dialog box... after including its js file. if you want to do it of your own then you need to compromise all the web browsers and this will be taken care by jquery. a javascript frame work. of if you want to do it of your own... ready about z-index and opacity... the gimmick is display a transparent div with 100% height and 100% width with the z-index more than any existing element. for example this overlay div will have zindex as 95. then display your rectangle dialog which will contain all three buttons above the overlay div with zindex more than 95. now try to click apart from the dialog rectangle( on any hyperlinks). nothing happens. the overlay div receives the mouse clicks because it has occupied the complete screen. once you click any button in the dialog then make the overlay div to display none and hide the rectangle. the above link is just an example. use the last one. and there are more than this in the web... so chose the one which will suite your design. and here is another use full link... http://jquery.malsup.com/block/#demos[^] you can search the web like "jquery modal dialog" and try to use your own words...

            Today's Beautiful Moments are Tomorrow's Beautiful Memories

            D Offline
            D Offline
            Dimitri Witkowski
            wrote on last edited by
            #5

            Thanks.. But it's not what I'm searching for :( It's modal but not synchronous. The key moment is that using this library, I cannot wait until the dialog is closed, like in: alert("test"); ... // will be executed after user clicks OK

            Die Energie der Welt ist konstant. Die Entropie der Welt strebt einem Maximum zu.

            1 Reply Last reply
            0
            • J Jayapal Chandran

              http://www.ericmmartin.com/projects/simplemodal-demos[^] try to use jquery. it will take just a single line of code to show a dialog box... after including its js file. if you want to do it of your own then you need to compromise all the web browsers and this will be taken care by jquery. a javascript frame work. of if you want to do it of your own... ready about z-index and opacity... the gimmick is display a transparent div with 100% height and 100% width with the z-index more than any existing element. for example this overlay div will have zindex as 95. then display your rectangle dialog which will contain all three buttons above the overlay div with zindex more than 95. now try to click apart from the dialog rectangle( on any hyperlinks). nothing happens. the overlay div receives the mouse clicks because it has occupied the complete screen. once you click any button in the dialog then make the overlay div to display none and hide the rectangle. the above link is just an example. use the last one. and there are more than this in the web... so chose the one which will suite your design. and here is another use full link... http://jquery.malsup.com/block/#demos[^] you can search the web like "jquery modal dialog" and try to use your own words...

              Today's Beautiful Moments are Tomorrow's Beautiful Memories

              C Offline
              C Offline
              Coding1
              wrote on last edited by
              #6

              Thanks for the links, I have been looking into this for a while.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups