Solved

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

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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

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…
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/…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

810 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