Solved

Window Post back to original Form

Posted on 2000-02-21
7
161 Views
Last Modified: 2013-12-24
Does anyone know how to launch a new window/Form and post back to the originating Window on submit using radio buttons.
0
Comment
Question by:fredphillippi
[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
7 Comments
 
LVL 5

Expert Comment

by:nathans
ID: 2543818
There are two ways depending on which one you want I can get into more detail.

1. Set session varibles
2. Use JavaScript

Maybe someone else knows of more ways.
0
 
LVL 4

Expert Comment

by:FRehman
ID: 2545212
use javscript
<Script language="JavaScript">
function displayHelp()
{
      helpWindow=window.open("Help.html", "Help", "toolbar=0,width=800,height=400,menubar=0,status=0,location=0,scrollbars=1,resizable=1,left=0,top=0,alwaysRaised=1");
}

</script>
0
 

Author Comment

by:fredphillippi
ID: 2545866
Thanks, I am close... See example.

I want to be able to send data from the opened (secondary) window back to the origniating window using radio buttons in a Form on the secondary window.

Here is an example using a dropdown menu. Help me make this radio buttons insted of a dropdown menu.

EXAMPLE:
Main Window:

script language="JavaScript"><!--
function myopen() {
    popupWindow=open('multiple.htm','windowName','resizable=no,width=400,height=300');
    if (popupWindow.opener == null) popupWindow.opener = self;
}
//--></script>

<form>
<input type="text" size="40" name="resultfield">
<input type="button" value="Open" onClick="myopen()">
</form>



And then in multiple.htm:

<script language="JavaScript"><!--
function update() {
    var output = '';

    for (var i=0;i < document.forms[0].selectfield.options.length;i++) {
         if (document.forms[0].selectfield.options[i].selected) {
             output += document.forms[0].selectfield.options[i].text + ' ';
         }
     }

    opener.document.forms[0].resultfield.value = output;
    window.close();
}
//--></script>

<form onSubmit="return false">
<select multiple name="selectfield">
<option>Monday
<option>Tuesday
<option>Wednesday
<option>Thursday
<option>Friday
<option>Saturday
<option>Sunday
</select>
<p>
<input type="button" value="Update" onClick="update()">
</form>

 





0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
LVL 5

Accepted Solution

by:
nathans earned 50 total points
ID: 2546135
<script language="JavaScript"><!--
function update(theRadio) {
   opener.document.forms[0].resultfield.value = theRadio.value;
   window.close();
}
//--></script>
<form onSubmit="return false">
<INPUT onClick="update(this)" TYPE="radio" NAME="day" VALUE="Monday">Monday
<INPUT onClick="update(this)" TYPE="radio" NAME="day" VALUE="Tuesday">Tuesday  
<INPUT onClick="update(this)" TYPE="radio" NAME="day" VALUE="Wednesday">Wednesday
<INPUT onClick="update(this)" TYPE="radio" NAME="day" VALUE="Thursday">Thursday
<INPUT onClick="update(this)" TYPE="radio" NAME="day" VALUE="Friday">Friday
<INPUT onClick="update(this)" TYPE="radio" NAME="day" VALUE="Saturday">Saturday
<INPUT onClick="update(this)" TYPE="radio" NAME="day" VALUE="Sunday">Sunday
</form>


OR

instead of the select just have your radio buttons like so:
<form name="days" onSubmit="return false">
<input type="Radio" name="day" value="Monday">Monday
<input type="Radio" name="day" value="Tuesday">Tuesday
<input type="Radio" name="day" value="Wednesday">Wednesday
<input type="Radio" name="day" value="Thursday">Thursday
<input type="Radio" name="day" value="Friday">Friday
<input type="Radio" name="day" value="Saturday">Saturday
<input type="Radio" name="day" value="Sunday">Sunday
<input type="button" value="Update" onClick="update()">
</form>

<script language="JavaScript"><!--
function update() {
    var output = '';
for (var i in document..musicType) {
   if (document.days.day[i].checked=="1") {         output+=document.days.day[i].value
   }    
}
    window.close();
}
//--></script>
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 2546160
nathans: thanx for posting my answer to your question here as the answer :-)
but there is an error:
the line:
>for (var i in document..musicType)
needs to be
for (var i in document.days.day)

CJ
0
 
LVL 5

Expert Comment

by:nathans
ID: 2546190
Your welcome...
0
 

Author Comment

by:fredphillippi
ID: 2548526
That worked!  Thanks!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

726 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