eruna — 2011-09-01T01:46:18-04:00 — #1
I'm using dynamically created upload fields that are in iframes.
(There is an "add another" button.) After uploading the file in the iframe, the file path is passed back to a hidden field in the form.
The tricky part is passing the data back to the correct hidden field since the name can't be determined ahead of time. Passing the data through $GET or $POST data is highly problematic.
So is there a way to find the div that contains the iframe from within the iframe.
drlinux — 2011-09-02T07:21:27-04:00 — #2
I think you can do something like this in the iframe;
var myDiv = parent.document.getElementById("myDivId");
eruna — 2011-09-05T11:22:46-04:00 — #3
Right, the problem is the id is unknown because its created dynamically. So I was trying to find the parent element rather than the parent page.
I figured out how to do this, though its somewhat convoluted. A function on the parent page cycles through the input fields and gathers the data. The function is triggered from inside the iframe when the upload is complete.