Prototype/script-atulo-us guidance needed, I think.


I’ve got an app\views\expenses\new.html.erb file displayed at Q1: Lines 22-26, repeated here create a drop-down list of “vendor names” in true Ajax fashion: they push all lower-positioned items south to make room for the vendor names being created. I’d rather cover the lower items while the drop-down is visible, and restore the covered item when the drop-down closes.

22: <div id="vendor_droplist" style="display:none"> 23: <%= select_tag "list", 24: options_for_select(@current_vendors), 25: :multiple => true %> 26: </div>

I tried to modify line 25 to: 25: :multiple => true, :z-index => 2 %> but that and other forms yielded syntax-error responses.

Q2:. I generated the content of @current_vendors with code in line 14: 14: <% @current_vendors = Vendor.find(:all).collect { |vendor| vendor.nickname } %>

I’d like to each current_vendors item to be a button whose: (i) toString method was invoked by options_for_select for presentation purposes; and (ii) onClick method invoke a specified function that:     a. copied the nickname in the drop-down to another text-box; and     b. invoked the toggle routine on the drop-down structure (the toggling currently works).

I poked around in books and online for an example of this kind of thing, but to no avail thus far. Any suggestions on where to look or how to implement this functionality.

Thanks in Advance, Richard

Last night, Ed from the B'more on Rails meetup group gave me the key idea: use ActiveRecord::Observer. So I'm working on doing that. If you post any details about how to do that before I figure it out from the documentation, I'd appreciate any such feedback.