Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2001-08-08
4
Medium Priority
?
481 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 800 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

824 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