Solved

Need return value from a modal windo using VB, NOT javascript.

Posted on 2001-08-08
4
467 Views
Last Modified: 2007-11-27
I have a question..  If I open a modal window, how do I set and retrieve the window.return value?  I can get it to work in Javascript, but not VB.
 
What I am doing is...
1.  Fill in a form field
2.  on blur, a modal window opens with a page that runs a pl-sql query and gets a value.
3.  this value is passed back to the window as the window.return value and can be used client side to populate a second field.

ALL NEEDS TO BE VB, NO JAVASCRIPT....
 
does that make sence?
 
Thanks for you help?  Any suggestions?
 
0
Comment
Question by:turbosig
  • 2
4 Comments
 
LVL 7

Expert Comment

by:John844
ID: 6365120
give us your working javascript code and we will convert it to vbscript for you.
0
 
LVL 2

Author Comment

by:turbosig
ID: 6365236
'****************************************************
''THIS IS THE PAGE THAT OPENS IN THE MODAL WINDOW....
'-- Next page below....
'****************************************************

<html>
<head>
     <title>modal window</title>
     <meta name="generator" content="BBEdit 6.0.2">
     <script type="text/javascript" language="javascript">
     <!--

     function init() {
          window.returnValue = "no selection made";
          document.childForm.childInput.value = window.dialogArguments.value;
     }
     
     function setVal(sob) {
          window.returnValue = sob.options[sob.selectedIndex].value;
     }
     
     //-->
     </script>
</head>
<body style="font-family:andale mono,verdana,arial,sans-serif;margin:10px" onload="init()">

<h2>This is the modal window</h2>

<p>Dismiss this window to pass the value back to the main page.</p>

<form name="childForm">
     <p>
     Passed Value<br />
     <input type="text" name="childInput" />
     </p>
     
     <p>
     <select name="childSelect" onchange="setVal(this)">
          <option value="">--select one--</option>
          <option value="disney">disney</option>
          <option value="warner brothers">warner brothers</option>
          <option value="20th century fox">20th century fox</option>
          <option value="mgm">mgm</option>
     </select>
     </p>
</form>

</body>

'*********************************************
'THIS IS THE FIRST PAGE
'*********************************************

<html>
<head>
     <title>modal dialog test</title>
     <meta name="generator" content="BBEdit 6.0.2">
     <script type="text/javascript" language="javascript">
     <!--

     function callDialog() {
          retVal = window.showModalDialog('modal.html',document.parentForm.passInput,'dialogWidth:300px;dialogHeight:400px;dialogTop:100px;dialogLeft:400px')
         
          document.parentForm.parentInput.value = retVal;
     }

     //-->
     </script>
</head>
<body style="font-family:andale mono,verdana,arial,sans-serif">

<h1>Test of Modal Dialogs</h1>

<form name="parentForm">
     <p>
     Value to Pass<br />
     <input type="text" name="passInput" value="flubber" />
     </p>
     
     <p>
     Return Value<br />
     <input type="text" name="parentInput" />
     </p>
</form>

<p><a href="javascript:callDialog()">Launch modal dialog</a></p>

</body>
</html>
0
 
LVL 5

Expert Comment

by:mattyk
ID: 6365273
Here you go

<html>
<head>
    <title>modal window</title>
    <meta name="generator" content="BBEdit 6.0.2">
    <script  language="vbscript">
   

    function init()
         window.returnValue = "no selection made"
         document.childForm.childInput.value = window.dialogArguments.value
    end function
   
    function setVal(sob)
         window.returnValue = sob.options(sob.selectedIndex).value
    end function
   
   
    </script>
</head>
<body style="font-family:andale mono,verdana,arial,sans-serif;margin:10px" onload="init()">

<h2>This is the modal window</h2>

<p>Dismiss this window to pass the value back to the main page.</p>

<form name="childForm">
    <p>
    Passed Value<br />
    <input type="text" name="childInput" />
    </p>
   
    <p>
    <select name="childSelect" onchange="setVal(me)">
         <option value="">--select one--</option>
         <option value="disney">disney</option>
         <option value="warner brothers">warner brothers</option>
         <option value="20th century fox">20th century fox</option>
         <option value="mgm">mgm</option>
    </select>
    </p>
</form>

</body>

and the main page:

<html>
<head>
    <title>modal dialog test</title>
    <meta name="generator" content="BBEdit 6.0.2">
    <script  language="vbscript">
   

    function callDialog()
         retVal = window.showModalDialog("modal.html",document.parentForm.passInput,"dialogWidth:300px;dialogHeight:400px;dialogTop:100px;dialogLeft:400px")
         
         document.parentForm.parentInput.value = retVal
    end function

   
    </script>
</head>
<body style="font-family:andale mono,verdana,arial,sans-serif">

<h1>Test of Modal Dialogs</h1>

<form name="parentForm">
    <p>
    Value to Pass<br />
    <input type="text" name="passInput" value="flubber" />
    </p>
   
    <p>
    Return Value<br />
    <input type="text" name="parentInput" />
    </p>
</form>

<p><a href="javascript:callDialog()">Launch modal dialog</a></p>

</body>
</html>

-matty
0
 
LVL 5

Accepted Solution

by:
mattyk earned 200 total points
ID: 6365281
oops actually swap

<a href="javascript:callDialog()">Launch modal dialog</a>

with

<a href="vbscript:callDialog()">Launch modal dialog</a>

it won't matter as far as the code working but it looks nicer :)

-matty
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now