Javascript code blocks in RJS

You could store the commands in an rjs template and keep it in a shared directory. Another idea is to give all of these fields a css class name that is the same the use the select prototype call to do it in one fell swoop using a collection proxy:

render :update do |page|
    page.select('.notice_fields').each do {|f| f.replace_html ''}
end

As long as all of the elements have class="notice_fields" you are good to go. Note that it can be any one of a number of classes for those elements or any other valid css selector.

-Bill

mofo mofo wrote:

No problem. Sorry about the replace_html bit as I should have caught that, but I was tired and headed to bed :slight_smile: Glad you got it to work.

-Bill

mofo mofo wrote: