Modal Windows

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • paull
    New Member
    • Mar 2009
    • 20

    Modal Windows

    Could anyone help me in creating modal windows? I tried using window.showModa lDialog , it worked in opening the modal window. But I am facing the following issues.
    1. On submit from the modal window, it is opening another window, it should be in the same window where submit happened.
    2. how can i pass the values from the modal window to parent window. I tried using window.opener.d ocument. ....
    but it is throwing javascript error

    thanks for ur help
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    there seems to be something wrong with your code…

    showModalDialog () @ MDC

    Comment

    • paull
      New Member
      • Mar 2009
      • 20

      #3
      But i need to return more than one values to the parent windows. how is it possible. I have some hidden fields in the parent window and I need to set the values to that hidden variables from the modal window..

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        put them into an array or object and return this. see also the MSDN description.

        Comment

        • paull
          New Member
          • Mar 2009
          • 20

          #5
          actually what i need is to close the modal window and submit the parent window, before submitting i need to assign some values to the variables in the parent window

          the following is my close function in the modal window.
          window.opener.d ocument.forms[0].action="act.do ?method=view";
          window.opener.d ocument.forms[0].ncId.value=ncI d;
          window.opener.d ocument.forms[0].submit();
          window.close();

          Comment

          • Dormilich
            Recognized Expert Expert
            • Aug 2008
            • 8694

            #6
            you can also do that right after the modal window was closed using its return value (assuming you use an object to get multiple values)

            Comment

            • paull
              New Member
              • Mar 2009
              • 20

              #7
              hi ,. m not clear with the reply. could u plz explain more?

              Comment

              • Dormilich
                Recognized Expert Expert
                • Aug 2008
                • 8694

                #8
                OK, something like
                Code:
                // assuming you return an object: {id: "id_value", page: "act.do?method=view"}
                var r = window.showModalDialog(…);
                document.forms[0].ncId.value = r.id;
                document.forms[0].action = r.page;

                Comment

                • paull
                  New Member
                  • Mar 2009
                  • 20

                  #9
                  how will we assign the return values from the modal window?

                  var r = window.showModa lDialog(…);

                  i mean, from where the value for r is assigned ? in my modal window, on click on close button , it should close the modal window and then submit of parent window should happen...

                  Comment

                  • Dormilich
                    Recognized Expert Expert
                    • Aug 2008
                    • 8694

                    #10
                    Originally posted by paull
                    i mean, from where the value for r is assigned ?
                    from within the modal window, see MSDN for further explanation.

                    Comment

                    • paull
                      New Member
                      • Mar 2009
                      • 20

                      #11
                      how can i submit an action to another jsp page from modal window. ...

                      I use struts...

                      Comment

                      • Dormilich
                        Recognized Expert Expert
                        • Aug 2008
                        • 8694

                        #12
                        use the submit() method.

                        Comment

                        Working...