# Link\_to\_remote to update multiple components

**URL:** <https://www.ruby-forum.com/t/link-to-remote-to-update-multiple-components/57506>\
**Category:** Rails\
**Created:** [April 11, 2006, 4:37pm UTC](https://www.ruby-forum.com/t/link-to-remote-to-update-multiple-components/57506 "2006-04-11T16:37:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Heist](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/67e7ee/32.png) [@Heist](https://www.ruby-forum.com/u/Heist)\
**Post date:** [April 11, 2006, 4:37pm UTC](https://www.ruby-forum.com/t/link-to-remote-to-update-multiple-components/57506/1 "2006-04-11T16:37:29Z")

</div>

How would go about to update multiple components when using  
link\_to\_remote?

I’ve got a button that lets you switch between languages and it has to  
update every component in my application (like, let’s say: the main  
screen, the top navigation bar and the search bar). Each component is  
created in a different DIV and whenever the language is switched, the  
entire application should reflect the change.

Using update\_element\_function is pretty much out of the equation because  
I can’t specify a controller/action for content (instead of _ugh_ just  
plain html). Same goes for using rjs.

---

<div class="post-metadata">

**Author:** ![Heist](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/67e7ee/32.png) [@Heist](https://www.ruby-forum.com/u/Heist)\
**Post date:** [April 12, 2006, 12:04am UTC](https://www.ruby-forum.com/t/link-to-remote-to-update-multiple-components/57506/2 "2006-04-12T00:04:43Z")

</div>

for something like that you should not be using submit\_to\_remote. It’s  
going  
to be much easier to just use a normal submit and post-back and do a  
redirect\_to that will refresh the entire app.

---

<div class="post-metadata">

**Author:** ![Heist](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/67e7ee/32.png) [@Heist](https://www.ruby-forum.com/u/Heist)\
**Post date:** [April 12, 2006, 4:17am UTC](https://www.ruby-forum.com/t/link-to-remote-to-update-multiple-components/57506/3 "2006-04-12T04:17:54Z")

</div>

Using rjs is easier to update multiple dom response to each ajax  
request.you can do sth like this:

```
render :update do |page|
  dom_partials_map.each do |domdiv,partialtemplate|
    page.replace_html domdiv, :partial=>partialtemplate
  end
end

```

Heist wrote:

> How would go about to update multiple components when using  
> link\_to\_remote?
