How to render an action in page.replace_html?

Hi all…

I have an action show_primary_contacts_edit in ci controller, that
renders
html. I have another action show_contacts_page in ci controller, that
returns RJS.

I want to replace a div “contacts_div” specified in
show_primary_contacts_edit.rhtml with the action
show_primary_contacts_edit. I wrote the code for this in
show_contact_page.rjs as:

page.replace_html “contacts_div”, render(:action =>
‘show_primary_contacts_edit’), :object => @contacts

The div is replaced. But no contents are displayed. I think the render
action in page.replace_html is not working.

How can i replace the html by the contents in an action?

Anybody please help me to solve this.

Thanks in advance
Suneeta

Suneeta Km wrote:

Hi all…

I have an action show_primary_contacts_edit in ci controller, that
renders
html. I have another action show_contacts_page in ci controller, that
returns RJS.

The action should render an rhtml page which renders a partial.

I want to replace a div “contacts_div” specified in
show_primary_contacts_edit.rhtml with the action
show_primary_contacts_edit. I wrote the code for this in
show_contact_page.rjs as:

page.replace_html “contacts_div”, render(:action =>
‘show_primary_contacts_edit’), :object => @contacts

I don’t know what the benefit of an .rjs is as a separate file. Just
write this
into the action that responds to show_contacts - I’m guessing Ajax calls
that
action:

render :partial => ‘show_contacts’, :locals => { :@contacts =>
@contacts }

That calls a partial named _show_contacts.rhtml.


Phlip
http://assertxpath.rubyforge.org/