By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,053 Members | 939 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,053 IT Pros & Developers. It's quick & easy.

Pop-Up Pass Multiple Dynamic Values Between Forms

P: n/a
Hello,

Thanks for taking a look at this!

Problem:
I'm trying to pass multiple dynamic values between a slaveform and a
masterform. The problem I'm having is on the slaveform I loop through
multiple records and want two values depending on the row they select.

slaveform: x=selected
Radio ID Location
x 1 1
2 2
3 3
..
..
..

So in the slaveform I want the ID=1 and Location=1 passed back to the
masterform. Since the row has been selected by selecting the radio
button. I'm using ASP to loop through the records of the database if
this makes any difference.

I would really appreciate an example or suggestions if you guys have
any.

Thanks !
Jul 23 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hey,

To return the information you can alway use opener. opener refers to the
parent document that opened the window. Something like:

if (opener && !opener.closed && opener.returnedValues) {
opener.returnedValues(id, location);
}

returnedValues is a function you have to write in the master form.

Now there are several ways to solve the other problem. You could build
an additional array, or you could make multiple hidden fields, but I
would think the following would be the easiest. You could integrate the
values in the radiobutton. For example, you could do the following:

<INPUT TYPE="radio" NAME="list" VALUE="1,0"> ID 1, Location 0
<INPUT TYPE="radio" NAME="list" VALUE="2,1"> ID 2, Location 1
<INPUT TYPE="radio" NAME="list" VALUE="3,2"> ID 3, Location 2

Now once you press 'the' button you can do the following

function sendBackValues()
{
list = document.myform.list;
for (i=0;list.length;i++)
{
if (list[i].checked) {
if (opener && !opener.closed && opener.returnedValues)
{
values = list[i].value.split(',');
opener.returnedValues(values[0], values[1]);
return;
}
}
}
alert('No options checked!');
}

Good luck,
Vincent
cwwilly wrote:
Hello,

Thanks for taking a look at this!

Problem:
I'm trying to pass multiple dynamic values between a slaveform and a
masterform. The problem I'm having is on the slaveform I loop through
multiple records and want two values depending on the row they select.

slaveform: x=selected
Radio ID Location
x 1 1
2 2
3 3
.
.
.

So in the slaveform I want the ID=1 and Location=1 passed back to the
masterform. Since the row has been selected by selecting the radio
button. I'm using ASP to loop through the records of the database if
this makes any difference.

I would really appreciate an example or suggestions if you guys have
any.

Thanks !


Jul 23 '05 #2

P: n/a
Hey Vincent,

Thanks so much for helping me out with this. I have the general idea
now of what you're suggesting. I am unclear how I should write the
returnedValues function on the parent document.

Could you give me just a little more direction ? Thanks !

Chad

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #3

P: n/a
Sure

Could you give me just a little more direction ? Thanks !


returnedValue is a function you can write yourself. I just thought it
was a good name, but you can name it 'monkey' if you like. You could
process the values in the following manner. Depending on what you want,
you could do anything else with it. This would be a possible implementation
<script language="JavaSCript">
<!--
function returnedValue(id, location) {

f = document.myForm;
f.id.value = id;
f.location.value = location;
}
<!-- -->
[...]
<FORM NAME="myForm" [...]>
[...]
<INPUT TYPE="hidden" name="id">
Location: <INPUT TYPE="text" name="location">
[...]
</FORM>

I hope it helps,
Vincent

Jul 23 '05 #4

P: n/a
Oh, I forgot, naming a name="id" might go wrong, since ID is usually
already an existent properties of an object. You might better call it
'theId' or something. And I made a typo in the method name. There should
be an s at the end of function returnedValues(id, location);

Vincent van Beveren wrote:
Sure

Could you give me just a little more direction ? Thanks !


returnedValue is a function you can write yourself. I just thought it
was a good name, but you can name it 'monkey' if you like. You could
process the values in the following manner. Depending on what you want,
you could do anything else with it. This would be a possible implementation
<script language="JavaSCript">
<!--
function returnedValue(id, location) {

f = document.myForm;
f.id.value = id;
f.location.value = location;
}
<!-- -->
[...]
<FORM NAME="myForm" [...]>
[...]
<INPUT TYPE="hidden" name="id">
Location: <INPUT TYPE="text" name="location">
[...]
</FORM>

I hope it helps,
Vincent


Jul 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.