[thelist] javascript parent window form update

Dan McCullough dan.mccullough at gmail.com
Fri Jun 9 11:35:07 CDT 2006


I have an javascript parent update script, it updates a the form field
with the returned value.  However I have a form where the fields are
in an array, so I pass back 5 forms at once.

image name:<br><input type="text" name="imageName[]" value="">&nbsp;&nbsp;&nbsp;
		<?php
			print "<a href=\"".$_SERVER['PHP_SELF']."?page=".$page."\"
onClick=\"openChild('upload.php?siteId=".$x."&field=imageName[".$x."]','win2')\">File
Upload</a>.<br>";
		?>
		image by-line:<br><input type="text" name="imageByLine[]" value=""><br>
		image story:<br><textarea name="imageBlurb[]" cols="75"
rows="10"></textarea><br>
		approved:&nbsp;&nbsp;<input type="checkbox" name="approved[]" value="1"><br>

so on and so forth down the line.  the openChild opens a small window.

in there its a simple form

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
	<title>Elauwit Newspaper Administration</title>
	</head>

<body>

<form name="uploadForm" method="post" action="upload.php"
enctype="multipart/form-data">
<p><input type="file" name="imageName"><br>
<input type="hidden" name="siteId" value="1">
<input type="hidden" name="field" value="imageName[]">
<input type="submit" name="submit" value="submit">


</body>
</html>

after you upload its supposed to put the value back in the
parent/opener window.  it works on other forms but because of the
array I am having an issue putting the value back on the page.

<SCRIPT LANGUAGE="JavaScript"><!--
opener.document.images.imageName[].value = '6215790.jpg';
self.close();
//--></SCRIPT>

I know why, I just dont know how to fix or tweak to make it work on
this form so that when I click it knows where to put the value.



More information about the thelist mailing list