Render :update / page.replace_html problem

Hi there,

I have this ajax problem, I’m desparately trying to debug since 1 entire
day now:

The Controller includes:

[…]
render :update do |page|
page.replace_html ‘coverletter_part’, :partial =>
‘user/applicationfiles/coverletter_part’
end
[…]

The View includes:

[…]

[...]

The _coverletter_part partial:

<% form_for(:coverletter, :url => {
path/to/call/the/above/mentioned/controller }) do |f| -%>

[…]

<% end -%>

Calling the controller, I get an error message of this type printed on
my screen:
(the actual error message is much longer, since it’s filled up with lots
of stuff)

try { …blah… } catch (e) { alert(‘RJS error:\n\n’ + e.toString());
alert(’ …blah… '); throw e }

Why does the javascript code not get executed?
(Actually, within the same project, I’ve proceeded in the same exact way
to update another DIV on the same exact view, just before calling the
above mentioned controller. And it worked. How come it doesn’t work this
(second) time?)

Can anybody save my weekend? That would be so cool!

Thanks very much!
Tom

On Oct 18, 11:21 am, Tom Ha [email protected] wrote:

Hi there,

I have this ajax problem, I’m desparately trying to debug since 1 entire
day now:

What’s calling the action? If you’ve passed an :update option to
link_to_remote (or remote_function etc…) then you must not use
render :update

Fred

On Oct 18, 4:55 pm, Tom Ha [email protected] wrote:

Well, this is the form that calls the action (so there is no “remote_”
to the form or submit tag).

If it’s just a regular post (ie not using remote_form_for) you can’t
use render :update.

Fred

Well, this is the form that calls the action (so there is no “remote_”
to the form or submit tag).

<% form_for (:cv, :url => ‘/user/cvs’, :html => { :multipart => true })
do |f| %>

Upload A CV: <%= f.file_field :uploaded_data %> <%= hidden_field_tag 'applicationfile_id', @applicationfile.id %>

<%= submit_tag 'Save' %>

<% end %>

Everything gets uploaded correctly with it. But it doesn’t update the
page (the DIV/partial), but instead just displays the javascript code…

If you need this to be Ajaxified use remote_form_for instead, also check
out: http://www.caboo.se/articles/2007/4/2/ajax-file-upload, as you’re
uploading file data.

Thanks for the clarification and your hints, guys!