Hiding <div> tag thru an action event

Hi,

I’m having a hard time figuring this one out - hopefully somebody can
shed some light on this.

I have a page with top half consisting a partial of the scaffold list
page, and bottom with another partial of a form, depending if the
user
clicks on ‘edit’ or ‘new’ on the top half list.

Now, when the page loads normally, I want to display just the list
(no
forms on the bottom). When I click on ‘edit’ one of the list entry
on
top, I want to display an ‘edit’ form for that entry. After clicking
update button, the form disappears and updates the list. I want to
same behavior with ‘new’ as well.

Note that this is only one page, so any action is involved will be
directed back to this page. Is there something in Rails that will
specify which action event has occurred? If so, I can put it like
this:

<% if (edit) %>
<% edit form %>
<% elsif (new) %>
<% new form %>
<% end %>

Thanks in advance.