Insert selection results to opener's form

T

tomb

I only understand the popup mechanism on an elementary level, but my
task is a bit more complex than that. If anyone can provide a guideline
or point me to one I would be most appreciative.

I would like to add functionality like an email address book that opens
in a popup, and then the selected email addresses are populated to the
main window form text box. I can open the popup, and I can populate the
list of email addresses, but I don't get how to interact between the two
windows and send the results back to the main window.

Is there some way of sending a reference to the text box to the popup
window? If so, I can set the value. Or, if there is a better way than
that, I'm all for it.

Please help - I've been searching for this all night and day!

Thanks in advance.

Tom
 
S

SAM

tomb a écrit :
I only understand the popup mechanism on an elementary level, but my
task is a bit more complex than that. If anyone can provide a guideline
or point me to one I would be most appreciative.

I would like to add functionality like an email address book that opens
in a popup, and then the selected email addresses are populated to the
main window form text box. I can open the popup, and I can populate the
list of email addresses, but I don't get how to interact between the two
windows and send the results back to the main window.

In the popup

<select onchange="var k = this.selectedIndex;
if(k==0) alert('Make a choice in this list');
else {
opener.document.forms[0].email.value = this.options[k].value;
self.close();
}">
<option selected>e-mail contacts</options>
<option value="(e-mail address removed)">Tartempion Marc</option>
<opt ...
</select>


In the main window

<form ... >
<p>e-mail : <input type=text name="email">
<a href="adBook.htm" onclick="adBook();" target="adbk">address book</a>

<script type="text/javascript">
function adBook() {
if(typeof(truc)=='undefined' || truc.closed)
truc = window.open('','adbk','width=300,height=500');
truc.focus();
}
</script>
 
T

tomb

Merçi, beaucoup!

T
tomb a écrit :
I only understand the popup mechanism on an elementary level, but my
task is a bit more complex than that. If anyone can provide a
guideline or point me to one I would be most appreciative.

I would like to add functionality like an email address book that
opens in a popup, and then the selected email addresses are populated
to the main window form text box. I can open the popup, and I can
populate the list of email addresses, but I don't get how to interact
between the two windows and send the results back to the main window.

In the popup

<select onchange="var k = this.selectedIndex;
if(k==0) alert('Make a choice in this list');
else {
opener.document.forms[0].email.value = this.options[k].value;
self.close();
}">
<option selected>e-mail contacts</options>
<option value="(e-mail address removed)">Tartempion Marc</option>
<opt ...
</select>


In the main window

<form ... >
<p>e-mail : <input type=text name="email">
<a href="adBook.htm" onclick="adBook();" target="adbk">address book</a>

<script type="text/javascript">
function adBook() {
if(typeof(truc)=='undefined' || truc.closed)
truc = window.open('','adbk','width=300,height=500');
truc.focus();
}
</script>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top