# render :update / page.replace\_html problem

**URL:** <https://discuss.rubyonrails.org/t/render-update-page-replace-html-problem/35479>\
**Category:** rubyonrails-talk\
**Created:** [October 18, 2008, 10:21am UTC](https://discuss.rubyonrails.org/t/render-update-page-replace-html-problem/35479 "2008-10-18T10:21:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![11175](https://avatars.discourse-cdn.com/v4/letter/1/8edcca/32.png) [@11175](https://discuss.rubyonrails.org/u/11175)\
**Post date:** [October 18, 2008, 10:21am UTC](https://discuss.rubyonrails.org/t/render-update-page-replace-html-problem/35479/1 "2008-10-18T10:21:41Z")

</div>

Hi there,

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

The Controller includes:

---

<div class="post-metadata">

**Author:** ![Frederick\_Cheung](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/frederick_cheung/32/3901_2.png) [@Frederick\_Cheung](https://discuss.rubyonrails.org/u/Frederick_Cheung)\
**Post date:** [October 18, 2008, 3:33pm UTC](https://discuss.rubyonrails.org/t/render-update-page-replace-html-problem/35479/2 "2008-10-18T15:33:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![11175](https://avatars.discourse-cdn.com/v4/letter/1/8edcca/32.png) [@11175](https://discuss.rubyonrails.org/u/11175)\
**Post date:** [October 18, 2008, 3:55pm UTC](https://discuss.rubyonrails.org/t/render-update-page-replace-html-problem/35479/3 "2008-10-18T15:55:16Z")

</div>

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| %\> &nbsp;&nbsp;\<p\> &nbsp;&nbsp;&nbsp;&nbsp;Upload A CV: &nbsp;&nbsp;&nbsp;&nbsp;\<%= f.file\_field :uploaded\_data %\> &nbsp;&nbsp;&nbsp;&nbsp;\<%= hidden\_field\_tag 'applicationfile\_id', @applicationfile.id %\> &nbsp;&nbsp;\</p\> &nbsp;&nbsp;\<p\> &nbsp;&nbsp;&nbsp;&nbsp;\<%= submit\_tag 'Save' %\> &nbsp;&nbsp;\</p\> \<% end %\>

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

---

<div class="post-metadata">

**Author:** ![Frederick\_Cheung](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/frederick_cheung/32/3901_2.png) [@Frederick\_Cheung](https://discuss.rubyonrails.org/u/Frederick_Cheung)\
**Post date:** [October 18, 2008, 4:02pm UTC](https://discuss.rubyonrails.org/t/render-update-page-replace-html-problem/35479/4 "2008-10-18T16:02:59Z")

</div>

> 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

---

<div class="post-metadata">

**Author:** ![11175](https://avatars.discourse-cdn.com/v4/letter/1/8edcca/32.png) [@11175](https://discuss.rubyonrails.org/u/11175)\
**Post date:** [October 18, 2008, 10:02pm UTC](https://discuss.rubyonrails.org/t/render-update-page-replace-html-problem/35479/5 "2008-10-18T22:02:41Z")

</div>

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](http://www.caboo.se/articles/2007/4/2/ajax-file-upload), as you're uploading file data.

---

<div class="post-metadata">

**Author:** ![11175](https://avatars.discourse-cdn.com/v4/letter/1/8edcca/32.png) [@11175](https://discuss.rubyonrails.org/u/11175)\
**Post date:** [October 20, 2008, 9:55pm UTC](https://discuss.rubyonrails.org/t/render-update-page-replace-html-problem/35479/6 "2008-10-20T21:55:05Z")

</div>

Thanks for the clarification and your hints, guys!
