Topic: RJS error when try to update partial


I have user's homepage and I'm trying to flash error when user misses some fields. for this I use error_message_helper, so in my home_controller I have:


render :update do |page|
  page.replace_html 'upload', :partial => 'uploadImage'


in my home/index.html.erb I have:
     <div id ="upload">
                                  <%= render 'home/uploadImage' %>

my _uploadImage.html.erb:

        <p><br />Upload an Image<br /></p>

         <div id="uploadImagePanel">
                <%= form_for @image, :html => { :multipart => true } do |f| %>
                <%= f.error_messages %>
                        <%= f.file_field :image  %>

                        <p><%= f.submit %></p>

I googled for few hours and this seems like it should work, but when I try to upload image with missing field instead of refreshed partial on my homepage, the whole page gets replaced with following error:

"try {
Element.update("character", "\n                                      <!--these are fields used to upload an image-->\n        <p><br />Upload an Image<br /></p>\n        ....}

Please help ASAP.

thanks in advance

Last edited by rauza (2011-03-25 08:35:02)