Pass back the value to opener window for dialog window!

hello, i have a very important question. I tried long time to fix the problem but unfortunately i can't work so i hope that any people can help me as soon as posible!!

I had done below section with the Window.Open, and its work... but i need to Model means set focus and not allow to go back to opener or parent window before cancel or pass value go.

This is the main page to call pop up window
<html>
<head>
<title>Untitled Document</title>

<script language="javascript">
      function OpenPopUp(){
Mywindow = window.open("popupmenu.htm", "Mywindow", "toolbar=no,location=yes,dicrectories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=475,height=155")
      }
      
</script>

</head>
<body>

<form NAme="myform" method="post">
      <input type="text" name="mytext" >
      <input type="submit" onClick="OpenPopUp()">            
</form>


</body>
</html>


This is the pop up box...... to pass back to main
<html>
<head>
<title>Untitled Document</title>

<script type="text/javascript" language="javascript">
      function updatewindow(){
            opener.document.myform.mytext.value = document.myform.mytext.value

      }
      
</script>
</head>
<body>

<form Name="myform" method="post">
      <input type="text" name="mytext" >
      <input type="submit" onClick="updatewindow()">      
</form>


</body>
</html>



so now i would like to know that if i use Dialog box
            Mywindow = window.showModalDialog("popupmenu.htm", "Mywindow", "dialogWidth: 500px; dialogHeight: 350px; center:yes");
i cannot pass back the value..
any ppl know...
or else any ppl can use Window.Open with Model?????

and i hope that this solution can allow a lot of button to call the window and pass back to each of the text box..
something like Lookup button.......

JackieWaiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

devicCommented:
hi JackieWai,

here is HOWTO showModalDialog


============index.html============================
<html>
<head>
<title>Untitled Document</title>
<script>
function OpenPopUp()
{
      return showModalDialog("popupmenu.htm", "Mywindow", "toolbar=no,location=yes,dicrectories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=475,height=155")
}
function run()
{
      document.myform.mytext.value=OpenPopUp();
}    
</script>

</head>
<body>
<form NAme="myform">
    <input type="text" name="mytext" >
    <input type="button" onClick="run()" value=run>          
</form>
</body>
</html>



====================popupmenu.htm==================
<html>
<head>
<title>Untitled Document</title>

<script>
    function updatewindow()
      {
            returnValue = document.myform.mytext.value;
            self.close();
    }
</script>
</script>
</head>
<body>

<form Name="myform">
    <input type="text" name="mytext" >
    <input type="button" onClick="updatewindow()" value="ok">    
</form>


</body>
</html>

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ZontarCommented:
showModalDialog() is MSIE only.

For cross-browser, use window.open() and put

onblur="self.focus();"

in the <body> tag.

Note: I find both methods to be EXTREMELY annoying when I come across sites that use them... but you asked.
JackieWaiAuthor Commented:
dear Zontar, your method can make it loop until focus... but unfortunately, i cannot type or click button, no have any function
any thanks.... you give me a good idea.

for devic, your method can use...very good.. until i feel very perfect.
but i got 1 problem, after i pass back my data but it auto refresh it until no have all data delete..

this should be very easy..
but i not sure is this because the method using POst
but i delete it also same..
any thing can make it not delete it..?
NetGrooveCommented:
Use this way of calling your modal window:

   Mywindow = window.showModalDialog("popupmenu.htm", window, "dialogWidth: 500px; dialogHeight: 350px; center:yes");

And the popup can access its opener window and openers objects trough this reference:
    window.dialogArguments

Here is the description:
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/methods/showmodaldialog.asp


Good luck,
NetGRoove

jaysolomonCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Split: devic {http:#9761240} & Zontar {http:#9761933} & NetGroove {http:#9762383}

Please leave any comments here within the next four days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jAy
EE Cleanup Volunteer
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.