Topic: Using iframes with parameters to render in the same page


I'm developing a rails app and need to do the following.

My main page (main.html.erb) has a small form and a submit button.
Also it has an inline iframe.

When click the submit button I need to pass some parameters to another
content page (content.html.erb) to create dynamic contents and load
the content page inside main page's inline iframe.

(What a user sees is only the main page and iframe content changes on
submit button click)

How can I do with this Rails? I tried several ways and sometimes even
my browser crashed. Thanks for your comments in advance.



Re: Using iframes with parameters to render in the same page

I would recommend using CSS/Javascript instead of an in-line iFrame.

I'm not an expert at RoR (yet anyway), but I know that Javascript libraries like JQuery can dynamically show/hide DIVs based on a form submit. In fact, using JQuery, you could have the form post to anywhere without refreshing the page. Then, you could have it update data on that page or show/hide a DIV. I'm sure there's a similar method used to do this in RoR, but I'd look into a JS/CSS way of doing it, if it's practical for your needs.