Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2001-08-08
4
Medium Priority
?
480 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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 would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

721 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