# Form\_remote\_tag

**URL:** <https://www.ruby-forum.com/t/form-remote-tag/108682>\
**Category:** Rails\
**Created:** [July 6, 2007, 12:07am UTC](https://www.ruby-forum.com/t/form-remote-tag/108682 "2007-07-06T00:07:58Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![pat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/8491ac/32.png) [@pat](https://www.ruby-forum.com/u/pat)\
**Post date:** [July 6, 2007, 12:07am UTC](https://www.ruby-forum.com/t/form-remote-tag/108682/1 "2007-07-06T00:07:58Z")

</div>

I am using form\_remote\_tag as follows:  
\<%= form\_remote\_tag(:update =\> “sku”, :url=\>{:action =\>:generate\_skus})  
%\>  
The problem I am having is the web page will actually change to the  
generate\_skus page which defeats the purpose of using this. Any ideas on  
why it wouldnt update the html code on the current page.

---

<div class="post-metadata">

**Author:** ![pat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/8491ac/32.png) [@pat](https://www.ruby-forum.com/u/pat)\
**Post date:** [July 6, 2007, 12:55am UTC](https://www.ruby-forum.com/t/form-remote-tag/108682/2 "2007-07-06T00:55:40Z")

</div>

Pat wrote:

> I am using form\_remote\_tag as follows:  
> \<%= form\_remote\_tag(:update =\> “sku”, :url=\>{:action =\>:generate\_skus})  
> %\>  
> The problem I am having is the web page will actually change to the  
> generate\_skus page which defeats the purpose of using this. Any ideas on  
> why it wouldnt update the html code on the current page.

Post the code that responds to that action.

–  
Phlip  
[Test Driven Ajax (on Rails) [Book]](http://www.oreilly.com/catalog/9780596510657/)  
“Test Driven Ajax (on Rails)”  
assert\_xpath, assert\_javascript, & assert\_ajax

---

<div class="post-metadata">

**Author:** ![pat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/8491ac/32.png) [@pat](https://www.ruby-forum.com/u/pat)\
**Post date:** [July 6, 2007, 1:13am UTC](https://www.ruby-forum.com/t/form-remote-tag/108682/3 "2007-07-06T01:13:24Z")

</div>

Phlip wrote:

> Pat wrote:
> 
> > I am using form\_remote\_tag as follows:  
> > \<%= form\_remote\_tag(:update =\> “sku”, :url=\>{:action =\>:generate\_skus})  
> > %\>  
> > The problem I am having is the web page will actually change to the  
> > generate\_skus page which defeats the purpose of using this. Any ideas on  
> > why it wouldnt update the html code on the current page.
> 
> Post the code that responds to that action.
> 
> –  
> Phlip  
> [Test Driven Ajax (on Rails) [Book]](http://www.oreilly.com/catalog/9780596510657/)  
> “Test Driven Ajax (on Rails)”  
> assert\_xpath, assert\_javascript, & assert\_ajax  
> controller  
> def generate\_skus  
> @output = “This is not correct”  
> render :partial =\> “generate\_skus”  
> end  
> view for \_generate\_skus  
> \<%= @output %\>

---

<div class="post-metadata">

**Author:** ![pat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/8491ac/32.png) [@pat](https://www.ruby-forum.com/u/pat)\
**Post date:** [July 6, 2007, 1:31am UTC](https://www.ruby-forum.com/t/form-remote-tag/108682/4 "2007-07-06T01:31:43Z")

</div>

Hi –

On Fri, 6 Jul 2007, Pat wrote:

> I am using form\_remote\_tag as follows:  
> \<%= form\_remote\_tag(:update =\> “sku”, :url=\>{:action =\>:generate\_skus})  
> %\>  
> The problem I am having is the web page will actually change to the  
> generate\_skus page which defeats the purpose of using this. Any ideas on  
> why it wouldnt update the html code on the current page.

Are you sure you’re loading the necessary JavaScript files? It sounds  
like maybe it’s falling back on doing a non-Ajax request to your  
action.

David

–

- Books:  
RAILS ROUTING (new! [http://www.awprofessional.com/title/0321509242](http://www.awprofessional.com/title/0321509242))  
RUBY FOR RAILS ([Ruby for Rails](http://www.manning.com/black))
- Ruby/Rails training  
& consulting: Ruby Power and Light, LLC ([http://www.rubypal.com](http://www.rubypal.com))

---

<div class="post-metadata">

**Author:** ![pat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/8491ac/32.png) [@pat](https://www.ruby-forum.com/u/pat)\
**Post date:** [July 6, 2007, 1:25am UTC](https://www.ruby-forum.com/t/form-remote-tag/108682/5 "2007-07-06T01:25:43Z")

</div>

> > Pat wrote:
> > 
> > > I am using form\_remote\_tag as follows:  
> > > \<%= form\_remote\_tag(:update =\> “sku”, :url=\>{:action =\>:generate\_skus})  
> > > %\>

I can’t help because I just never use :update. I know it’s useful…

> ```
> def generate_skus
> @output = "This is not correct"
> render :partial => "generate_skus"
> end
> 
> ```
> 
> view for \_generate\_skus  
> \<%= @output %\>

I’m also aware that some people don’t like to mix model and view code.  
But I  
would have written the response like this:

render :update do |page|  
page.replace\_html ‘sku’, @output  
end

–  
Phlip  
[Test Driven Ajax (on Rails) [Book]](http://www.oreilly.com/catalog/9780596510657/)  
“Test Driven Ajax (on Rails)”  
assert\_xpath, assert\_javascript, & assert\_ajax

---

<div class="post-metadata">

**Author:** ![pat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/8491ac/32.png) [@pat](https://www.ruby-forum.com/u/pat)\
**Post date:** [July 6, 2007, 1:37am UTC](https://www.ruby-forum.com/t/form-remote-tag/108682/6 "2007-07-06T01:37:06Z")

</div>

unknown wrote:

> Hi –
> 
> On Fri, 6 Jul 2007, Pat wrote:
> 
> > I am using form\_remote\_tag as follows:  
> > \<%= form\_remote\_tag(:update =\> “sku”, :url=\>{:action =\>:generate\_skus})  
> > %\>  
> > The problem I am having is the web page will actually change to the  
> > generate\_skus page which defeats the purpose of using this. Any ideas on  
> > why it wouldnt update the html code on the current page.
> 
> Are you sure you’re loading the necessary JavaScript files? It sounds  
> like maybe it’s falling back on doing a non-Ajax request to your  
> action.
> 
> David
> 
> –
> 
> - Books:  
> RAILS ROUTING (new! [http://www.awprofessional.com/title/0321509242](http://www.awprofessional.com/title/0321509242))  
> RUBY FOR RAILS ([Ruby for Rails](http://www.manning.com/black))
> - Ruby/Rails training  
> & consulting: Ruby Power and Light, LLC ([http://www.rubypal.com](http://www.rubypal.com))

I have used  
\<%= javascript\_include\_tag :defaults %\>  
which generates the following javascript

---

<div class="post-metadata">

**Author:** ![pat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/8491ac/32.png) [@pat](https://www.ruby-forum.com/u/pat)\
**Post date:** [July 8, 2007, 12:50am UTC](https://www.ruby-forum.com/t/form-remote-tag/108682/7 "2007-07-08T00:50:28Z")

</div>

I have the \_generate\_skus.rhtml in the views folder for the controller  
that calls it and there is not a generate\_skus.rhtml.

---

<div class="post-metadata">

**Author:** ![pat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/8491ac/32.png) [@pat](https://www.ruby-forum.com/u/pat)\
**Post date:** [July 6, 2007, 7:08pm UTC](https://www.ruby-forum.com/t/form-remote-tag/108682/8 "2007-07-06T19:08:20Z")

</div>

If I understand what you’re saying - your generate\_skus partial is being  
rendered as a seperate page?

Is your generate\_skus partial page named correctly? It’s been a little  
while since I fooled with a partial, and I don’t have my environment  
here  
with me, but I think skus are named like “\_generate\_skus.rhtml” - do you  
maybe have a file named “generate\_skus.rhtml”?

Or do you have both \_generate\_skus.rhtml and generate\_skus.rhtml in the  
same  
folder? Though I wouldn’t think that would be a problem.

Sorry if I’m mucking this up with the wrong syntax! 😃

On 7/5/07, Pat [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > > %\>  
> > > David  
> > > which generates the following javascript
> 
> –  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> >

–  
Terry (TAD) Donaghe  
[http://tadspot.tumblr.com](http://tadspot.tumblr.com)

> **[太阳集团0638开头的网址✅【欢迎下载】](http://www.rubynoob.com)**
>
> 太阳集团0638开头的网址是一家创办历史悠久并且具有非常高的知名度的在线网娱乐平台为大家提供一个良好的彩票交流平台。
