Solved

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

Posted on 2001-08-08
4
468 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
JQuery Date Time picker not showing 29 114
ASP.net VB.net gather value of text box text change 4 44
asp syntax 3 39
Query not working correctly? (or how i want it to... 6 49
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…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

863 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

25 Experts available now in Live!

Get 1:1 Help Now