Problems with inline RJS in Rails

I have the following form allowing users to enter their postcode:

<%= form_remote_tag(  :action => 'lookup_postcode',  :update => 'results',  :complete => "new Effect.SlideDown('lookupResults')" )%>...

To display the matching addresses, I then render a partial that contains the drop-down list and select button as follows (inside the `lookup_postcode` action):

if params[:selected_address].nil?  @results = PostcodeLookup.find(params[:postcode])  render_partial("postcode_results")

To avoid having many nested forms, I check to see whether the posted information included a selected address. If they have selected an address, I then use inline RJS to render the JavaScript necessary to get the address_fields filled:

render :update do |page|  page.hide 'originAddressLookupResults'  page.visual_effect :highlight,    'originAddress',    :duration => 3  page.replace_html('originAddressEntry',    :partial => 'address')end

Since the model fields the address partial is bound to are populated with the data from the lookup, the address does display with the selected values.

However, I’ve noticed that in FireFox I see the generated JavaScript from the inline RJS code—not particularly nice.

I originally thought it might be something to do with how WEBrick and FireFox were interpreting the generated script, but having also run the site through Lighttpd it also seems to show the code. Has anyone else had a similar problem? Or is it abundantly clear that I’ve missed something (again) :)

Anyway, it’s been fun getting Rails onto Edge and then playing with RJS, think I just need to find some good form patterns to determine the best way of having multiple tasks within a wider process performed through a single form—I’ll post my thoughts as I get further into it!