Possible RJS Implementation?

Hi there,

I have a question regarding updating elements of a two different divs
with
one click. I have two lists. One list holds items that are entered into
a
contest, and the other list holds items that aren’t currently in the
contest. One item can only be in one list at a time.

Each list has a partial that renders the items with corresponding
actions.
The items in the current contest list have an action of ‘remove from
contest’ and the items currently not in a contest have an action of ‘add
to
contest’.

When one item is added or removed from their appropriate list I would
like
for it to fade in on the other list.

I currently have the fade out part working fine on both lists when an
item
is selected. It’s the dynamically adding a new div id on the other list
that’s giving me some issues.

Here’s what I currently have for the remove and add to list:

The items that are available:

<% for song in @elgibile_songs %>
<%= song.title %>
        <div class="elgibile_entered_link">

            <%= link_to_remote h("Submit to this contest"), {
                         :url => { :action => 'contest_enter', :id 

=>
@contest, :song_id => song.id },
:complete => visual_effect(:fade,
“elgibile_id_of_#{song.id}”)} %>

        </div>
    </div>
<% end %>

The items that are no available:

<% for song in @ineligible_songs %>
<%= song.title %>
        <div class="ineligible_entered_link">

            <%= link_to_remote h("Remove from this contest"), {
                         :url => { :action => 'contest_unsubmit', 

:id =>
@contest, :song_id => song.id },
:complete => visual_effect(:fade, “id_of_#{
song.id}”, :duration => 1),
:confirm => “Are you sure you want to remove
“#{song.title}” from the contest?” }%>

        </div>
    </div>
<% end %>

The two actions in the methods that handle the corresponding actions
look
like this:

def contest_enter
#enter2: finish submission of song to contest
@contest = Contest.find(params[:id])
@song = Song.find(params[:song_id])
@member = session[:member_id]
ContestEntry.find_or_create_by_song_id_and_contest_id(@song.id,@
contest.id)
@elgibile_songs = ContestEntry.elgibile_songs(@member.id,
@contest.id)
end

def contest_unsubmit
#unsubmit: remove a contest entry
@contest = Contest.find(params[:id])
@song = Song.find(params[:song_id])
c = ContestEntry.find_by_song_id_and_contest_id(@song.id,@contest.id)
ContestEntry.delete(c.id)
end

Are there any tutorials that cover what I want to do? I’m thinking I may
have to explore RJS a little bit.

Thank you,
Dave H.