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.