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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parsing info from child to parent using javascript??

Status
Not open for further replies.

philipmatic

Programmer
May 18, 2003
17
JP
Hi all, I have this piece of code and it's killing me to solve it... So I was hoping someone may help me out here...

I have a page with 3 textareas, and each textarea has it's own button to popup a new window. All fine here... Now here is the problem...

ok when I click on the first popup button and click save within the child window, the parent page refreshes and content appears in the 1st textarea. This is all fine!! But when I try to click on the 2nd button to popup a new window and then save information from the 2nd child window to the main parent, it refreshes the parent window and the 2nd textarea is filled, but the 1st textarea content disappears!!! THIS IS THE PROBLEM!!!

Can anyone help me with the correct javascript to make this puppy work as it is suppose to work... I have tried a few things but they were NO GOOD!!!

PLEASE I NEED HELP HERE!!!
 
Why refresh? Can't you just update the contents of the textarea? Or is something more going on there?

Cheers,
Dian
 
Hi Diancecht,

If I can get the textarea to just update the contents that would be great without refreshing...

Thanks for your help on this please find the code attached below:
**** parent window ****

<table>
<tr>
<td><input type="submit" value="Save">
<input type="button" value="Cancel" onclick="location.href='newsletters.php?uid=<?=$_SESSION['ugid']?>';" /></td>
</tr>
<tr>
<td><label>Issue Title</label></td>
<td><input type="text" name="title" value="" size="35" /></td>
</tr>
<tr><td colspan="2">&nbsp;</td></tr>
<tr><td><label>Article Heading 1</label></td>
<td><input type="text" name="heading_1" value="" size="35" /></td></tr>
<tr>
<td><label>Content 1</label></td>
<td><textarea cols="35" rows="5" name="content_1"><?php
$sValue1 = stripslashes($_POST['FCKeditor1']);
echo($sValue1);?></textarea>
<input type="button" name="editor_1" value="Editor" onclick="openwindow('editor.php?content=1','',600,300,'no');"
style="font-family: Verdana; font-size: 8pt; color: #000000; background-color: #ffffff; border: 1px solid #000000; "/></td>
</tr>
<tr><td colspan="2">&nbsp;</td></tr>
<tr><td><label>Article Heading 2</label></td>
<td><input type="text" name="heading_2" value="" size="35" /></td></tr>
<tr><td><label>Content 2</label></td>
<td><textarea cols="35" rows="5" name="content_2"><?php
$sValue2 = stripslashes($_POST['FCKeditor2']);
echo($sValue2);?></textarea>
<input type="button" name="editor_2" value="Editor" onclick="openwindow('editor.php?content=2','',600,300,'no');"
style="font-family: Verdana; font-size: 8pt; color: #000000; background-color: #ffffff; border: 1px solid #000000;" /></td></tr>
<tr><td colspan="2">&nbsp;</td></tr>
<tr><td><label>Article Heading 3</label></td>
<td><input type="text" name="heading_3" value="" size="35" /></td></tr>
<tr><td><label>Content 3</label></td>
<td style="text-align:left;"><textarea cols="35" rows="5" name="content_3"><?php $sValue3 = stripslashes($_POST['FCKeditor3']);
echo($sValue3);?></textarea>
<input type="button" name="editor_3" value="Editor" onclick="openwindow('editor.php?content=3','',600,300,'no');"
style="font-family: Verdana; font-size: 8pt; color: #000000; background-color: #ffffff; border: 1px solid #000000;" /></td>
</tr>
<tr><td colspan="2">&nbsp;</td></tr>
</form>
</table>

***** child popup window *****

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>FCKeditor - Sample</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex, nofollow">
<link href="../sample.css" rel="stylesheet" type="text/css" />
</head>
<body>
<hr>
<form action="addnewsletter.php?content=<?=$contentid;?>" method="post" target="content">
<?}
$sBasePath = $_SERVER['PHP_SELF'] ;
$sBasePath = substr( $sBasePath, 0, strpos( $sBasePath, "FCKeditor" ) ) ;
$oFCKeditor = new FCKeditor('FCKeditor' . $contentid) ;
$oFCKeditor->BasePath = '../FCKeditor/';//$sBasePath ;

$oFCKeditor->Value = '';
$oFCKeditor->Width = '100%' ;
$oFCKeditor->Height = '200' ;
$oFCKeditor->Create() ;

?>
<br>
<input type="submit" value="Submit" style="font-family: Verdana; font-size: 8pt; color: #000000; background-color: #ffffff; border: 1px solid #000000; " />
<input type="button" value="Cancel" style="font-family: Verdana; font-size: 8pt; color: #000000; background-color: #ffffff; border: 1px solid #000000; "
onclick="location.href='addnewsletter.php';window.close();" />
</form>
</body>
</html>

*********************

If you want a working example (that is see my delemma in action), please tell me and I will give you the url...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top