Forum Moderators: open

Message Too Old, No Replies

pass data from iframe to parent form

         

rsmarsha

10:46 am on Aug 7, 2008 (gmt 0)

10+ Year Member



I'm trying to pass data from an iframe within a page back to the form fields of a form in the page which includes the iframe.

I am getting :

Error: Permission denied to get property Window.document
Source File: orders_customer_finder_inline.php
Line: 1

Errors when i click the link with variables.

The iframe has a form which the user can use to find a customer by his/her postcode. When you submit the form a results page is shown in the iframe. Clicking a result link runs the following:


<a href="" onClick="parent.document.detailsFormMain.forename.value = '<?php echo $cr['forename'];?>';window.close()" />Select This Customer</a>

the field i'm trying to populate is in the form "detailsFormMain" with the fieldname of "forename".

Any ideas?

Trace

1:01 pm on Aug 7, 2008 (gmt 0)

10+ Year Member



Give your inputs some ID's and access them like this;

parent.document.getElementById('detailsFormMain').value

I just tried, and it seems to work as expected.

bonagiri

1:50 pm on Aug 7, 2008 (gmt 0)

10+ Year Member



Try this, but I'm not sure

<a href="" onClick="window.opener.document.detailsFormMain.forename.value = '<?php echo $cr['forename'];?>';window.self.close();" />Select This Customer</a>

rsmarsha

3:07 pm on Aug 7, 2008 (gmt 0)

10+ Year Member



Thanks.

I've tried both those methods and normally they work but for some reason in the backend of jshop (the cart software) they don't.

I'll keep looking into it.

rsmarsha

9:50 am on Aug 8, 2008 (gmt 0)

10+ Year Member



Panic and confusion over, i'd put the wrong address in so it was trying to link back to our live server and not dev. :)