How to update an iframe element with form_remote_tag?

Why can't you give the iframe an id and just use rjs to insert the content from the controller?

Christopher Berner wrote:

William Pratt wrote:

Why can't you give the iframe an id and just use rjs to insert the
content from the controller?

This is the same dilema I have and I like what this solution poses
however, I'm still not great an using javascript within rails. I'm good
with javascript just not intermixing.

I have a iframe that renders a partial (containing a list) using a
"url_for" in the src attribute of the iframe. The list provides the
user the ability to move list items up or down in the list, which I'd
then like to update by re-rendering the partial. Problem is all my
"link_to_remote.." links in the list don't function now that the partial
is rendered in the iframe. I'm guessing that's because the
link_to_remotes are attempting to update a div that wraps the iframe but
I wouldn't know what else to update. Why doesn't just updating or
re-rendering the partial update the partial within the iframe?

Corey Murphy wrote:

I have a iframe that renders a partial (containing a list) using a "url_for" in the src attribute of the iframe. The list provides the user the ability to move list items up or down in the list, which I'd then like to update by re-rendering the partial. Problem is all my "link_to_remote.." links in the list don't function now that the partial is rendered in the iframe. I'm guessing that's because the link_to_remotes are attempting to update a div that wraps the iframe but I wouldn't know what else to update. Why doesn't just updating or re-rendering the partial update the partial within the iframe?

You'll have to create a special layout for the iframe that wraps
a simple HTML head and body, with the head containing a link
to prototype.js.

May I ask why you're using an iframe? Could you get away with
an "overflow: auto" div?

Mark Reginald James wrote:

You'll have to create a special layout for the iframe that wraps
a simple HTML head and body, with the head containing a link
to prototype.js.

May I ask why you're using an iframe? Could you get away with
an "overflow: auto" div?

--
We develop, watch us RoR, in numbers too big to ignore.

I ended up using exactly that solution (div with overflow). I was only
looking for the scrolling ability however, once I had encountered the
iframe issue, it became my mission to resolve the problem that way or at
least get a better understanding of why it behaved the way it did.

Thanks for the help,