ainoy31 Posted August 15, 2010 Share Posted August 15, 2010 I am dynamicly generating multiple forms to submit the complete path to an image. I am using the JS document.formname.submit(). After clicking on the image text link, I get the error message that "document.name is null or not an object or undefined". I have viewed the source page and the forms have the correct name with the image. Did a print on the form name passed to the JS goForm and it displays the correct form name. Thanks. Here is my code: <? if($dh=dir($folder)) { $cnt=0; while($file=$dh->read()) { $pic = $folder . '/' . $file; if($file != '.' && $file != '..') { $prodimage = "image" . $cnt; ?> <form name="<?=$prodimage;?>" action="imageModify.php" method="post"> <input type="hidden" name="img" value="<?=$pic;?>"> <a href="javascript: goForm('<?=$prodimage;?>');"><?=$file;?></a><br /><br /> </form> <? } $cnt++; } } ?> <script type="text/javascript"> function goForm(name) { //document.write(name); document.name.submit(); } </script> Quote Link to comment Share on other sites More sharing options...
RussellReal Posted August 15, 2010 Share Posted August 15, 2010 try this.. eval("document."+name+".submit();"); Quote Link to comment Share on other sites More sharing options...
ainoy31 Posted August 15, 2010 Author Share Posted August 15, 2010 Thanks man. Would have never thought of that. It is working now. Quote Link to comment Share on other sites More sharing options...
RussellReal Posted August 15, 2010 Share Posted August 15, 2010 anytime man Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.