# Page.insert\_rhtml in partial displayed by page.insert\_rhtml

**URL:** <https://www.ruby-forum.com/t/page-insert-rhtml-in-partial-displayed-by-page-insert-rhtml/128698>\
**Category:** Rails\
**Created:** [February 10, 2008, 6:51pm UTC](https://www.ruby-forum.com/t/page-insert-rhtml-in-partial-displayed-by-page-insert-rhtml/128698 "2008-02-10T18:51:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ankit2584](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/51bf81/32.png) [@ankit2584](https://www.ruby-forum.com/u/ankit2584)\
**Post date:** [February 10, 2008, 6:51pm UTC](https://www.ruby-forum.com/t/page-insert-rhtml-in-partial-displayed-by-page-insert-rhtml/128698/1 "2008-02-10T18:51:32Z")

</div>

hello,  
I need to use page.insert\_html inside a partial that rendered and  
displayed by using page.insert\_html.

This is because a form has a inner form that is called dynamically and  
the inner form again has a form.  
i.e. an event has many eventdays and an eventdays has many speakers.

The part of code in \_eventday.rhtml is as follows.

. . . .

| NEAREST PUBLIC TRANSPORT:\<%=eventday\_form.text\_field("event\_day\_nearest\_public\_transport",:index=\>nil,:size=\>"40")%\> |

\<%render :partial=\>'speaker/speaker',:collection=\>eventday.speakers%\> 
**\<%=link\_to\_function "Add a Speaker" do |page1| page1.insert\_html :after,:speakers,:partial=\>'speaker/speaker',:object=\>Speaker.new end%\>** \<%end%\>

The above partial is called as follows# code in new.rhtml

\<%=render :partial=\>'eventday/eventday',:collection=\>@event.eventdays%\> 
**\<%=link\_to\_function "Add an Event Day" do |page| page.insert\_html :bottom,:eventdays,:partial=\>'eventday/eventday',:object=\>Eventday.new end%\>**

I am unable to get the form working but as soon as i remove the  
page.insert\_html in \_eventday.rhtml i do not get error but ofcourse the  
innermost form isnt displayed.

Please advise what needs to be done to solve the problem.

Thank you.
