Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Making child window share info with parent window...

Status
Not open for further replies.

cradletoenslave

Programmer
Jan 28, 2005
29
US
I'm trying to create a form, and I want the client to be able to click a link to autofill in parts of the form. Any tips are greatly appreciated.
 
Well, no offense, but imaginary questions yield imaginary answers.

Let's say you click on a link in the parent window, which opens a popup window with a form on it.

Now, let's imagine that there's a button on this form in the child window. Your button code could potentially look something like this:

Code:
<input type="button" onclick="opener.document.forms['formname'].elements['fieldname'].value='hi there';" />

Where "formname" is the name of a form on your parent page and "fieldname" is the name of a field on your parent page.

*cLFlaVA
----------------------------
[tt]i'll be your best-kept secret and your biggest mistake...[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Wow, I'm not the only cradle of filth fan on tek-tips

-kaht

Weaseling out of things is important to learn. It's what separates us from the animals... except the weasel. - Homer Simpson (no, I'm not Homer)
 

1999 release

And before you get freaked out, I don't have long hair (anymore), I've never dyed it black, I don't wear makeup, and I've never sacrificed any small animals. I'm like any other regular joe. However, I've played guitar for 14 years and I have a wide appreciation of metal.

-kaht

Weaseling out of things is important to learn. It's what separates us from the animals... except the weasel. - Homer Simpson (no, I'm not Homer)
 
Okay, thanks cLFlaVA, I'll give it a shot. I understood the code part, but not your "imgainary questions" part! LOL Thanks for the info, it really helps.

Nice to know another Cradle of Filth fan. I have a wide appreciation for any music with talent. I love the melodies that Cradle produces. I'm not strictly a metalhead (although largely), I also perform in a school jazz band. I love classical music as well. I play guitar and can outplay just about anybody, especially in metal.

-I'll carry on this part of the conversation somewhere else, please don't post a reply to this topic here. This is a code forum and I don't wish to detour people getting help.
 
Okay, thanks for the idea! I used your idea with another code and came up with something that worked out okay. I can't wait until I get broke into the feel of javascript, I'm still pretty new to it.

Here's my code:

Code:
<script language="javascript">
function passit(){
opener.document.form.firstname.value = document.childform.update.value;
}
self.close();
return false;
</script>
<form onSubmit="return passit();">
<input type="text" name="update">
<input type="submit">
</form>

Thanks for the help, I could not have done this alone. (This code may not be entirely accurate, I retyped it all instead of copying and pasting. I've found it helps me learn faster.)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top