Reputation: 87
This isn't a "how to" question at this stage, more of a "can I."
I am capturing form data on /page1.php - upon submit /page2.php is loaded which contains further form fields that are displayed via an iframe. The form that is loaded is hosted on another server (just in case that makes a difference).
The question I have is; Is there anyway of using javascript (or any other language) to autofill a field that is in the iframe?
I hope that makes sense but if anyone needs any clarification, please let me know.
thanks
Upvotes: 1
Views: 264
Reputation: 1856
This part is important:
The form that is loaded is hosted on another server (just in case that makes a difference).
That makes a big difference, here's why:
"The same-origin policy restricts how a document or script loaded from one origin can interact with a resource from another origin." https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy
You can try to use some Ajax to interact between the pages.
Upvotes: 1