Topic: Another blind_down, blind_up question...

I read the other post about blind_up/blind_down, but it didn't help me much. I am just learning Rails so if I sound dumb, sorry.
I am doing a tutorial that invoked the :blind_down function when you add an item to the shopping cart, and one of the extra tasks is to invoke the blind_up function when the shopping cart is emptied (with an empty cart button). So I created a .rjs file to define and call the blind_down but whenever I put the blind_up in there it gives an error. I have tried different locations and syntax but alway get an error.
Do I link the blind_up to the button being pushed or the cart being empty? Once again, sorry for being so uninformed.........

Re: Another blind_down, blind_up question...

I have used the blind_up and blind_down from the Effects.js file in the public/javascript folder created by rails.  What I found was easiest is to initially use the toggle function and once everything was in place, the switch from the one-part toggle to the two-parted calls.  Also make sure you are calling the tag when you call the javascript (in the example 'hideAA')

<div class="centered"><%= check_box :applicantaad, :declined, {:onClick => "new Effect.toggle('hideAA')", :checked => "new Effect.toggle('hideAA')"}, '1', '0' %> Declined To State</div>

<div id = "hideAA">
  <div class="label">Gender:</div>
  <div class="content">
    <%= radio_button :applicantaad, :gender, :'M', {} %> Male
    <%= radio_button :applicantaad, :gender, :'F', {} %> Female

also make sure you are calling the Effects.js in your head, I do not recall if prototype.js is required, but know that the validation.js will not be.

  <script src="/javascripts/prototype.js" type="text/javascript"></script>
  <script src="/javascripts/validation.js" type="text/javascript"></script>
  <script src="/javascripts/effects.js" type="text/javascript"></script>
  <%= stylesheet_link_tag 'scaffold' %>
  <%= stylesheet_link_tag 'style' %>

Re: Another blind_down, blind_up question...

Thank you for the reply Passanger. I am going to give that a shot now.

Re: Another blind_down, blind_up question...

That is from the AWDWR book right ?
In your _cart.rjs you have:
[code ruby]<% form_remote_tag :url => {:action => :empty_cart} do %>
  <%= submit_tag 'Empty cart' %>
<% end %>[/code]

then in your store controller you have:
[code ruby]
def empty_cart
  session[:cart] = nil

and in your empty_cart.rjs:
[code ruby]
page[:cart].visual_effect :blind_up[/code]

Thats it smile

Re: Another blind_down, blind_up question...

That did it! Thank you !!!!! I think I spent way too much time making that more complicated than it should have been. Thank you again for the replys!  You guys ROCK!!!