# Newbi - form\_remote\_tag doesn't produce any HTML

**URL:** <https://rubytalk.org/t/newbi-form-remote-tag-doesnt-produce-any-html/32323>\
**Category:** ruby-talk\
**Created:** [25 October 2006 21:50 UTC](https://rubytalk.org/t/newbi-form-remote-tag-doesnt-produce-any-html/32323 "2006-10-25T21:50:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![helzer](https://avatars.discourse-cdn.com/v4/letter/h/e19b73/32.png) [@helzer](https://rubytalk.org/u/helzer)\
**Post date:** [25 October 2006 21:50 UTC](https://rubytalk.org/t/newbi-form-remote-tag-doesnt-produce-any-html/32323/1 "2006-10-25T21:50:19Z")

</div>

Hi,

I'm completely new to Ruby/Rails, so sorry for asking newbi questions.

I'm just following the Agile Web Development book, and got to the AJAX  
section.  
Added the code from the web, to generate the .js which triggers the  
AJAX, but no .js code appears in the HTML.

This is what I've added to the .rhtml code (from the book):

> **···**
>
> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> \<% for product in @products -%\>  
> &nbsp;&nbsp;\<div class="entry"\>  
> &nbsp;&nbsp;&nbsp;&nbsp;\<img src="\<%= product.image\_url %\>"/\>  
> &nbsp;&nbsp;&nbsp;&nbsp;\<h3\>\<%= h(product.title) %\>\</h3\>  
> &nbsp;&nbsp;&nbsp;&nbsp;\<%= product.description %\>  
> &nbsp;&nbsp;&nbsp;&nbsp;\<span class="price"\>\<%= number\_to\_currency(product.price) %\>\</span\>
> 
> &nbsp;&nbsp;&nbsp;&nbsp;\<% form\_remote\_tag :url =\> { :action =\> :add\_to\_cart, :id =\>  
> product } do %\>  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<%= submit\_tag "Add to Cart" %\>  
> &nbsp;&nbsp;&nbsp;&nbsp;\<% end %\>  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br clear="all"/\>  
> &nbsp;&nbsp;\</div\>  
> \<% end %\>  
> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
> 
> Surprisingly, the HTML source that I see in the browser doesn’t contain  
> any .js code. This is what I’m getting:  
> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> &nbsp;&nbsp;\<div class=“entry”\>  
> &nbsp;&nbsp;&nbsp;&nbsp;\<img  
> src=“[http://www.onthegosoft.com/images/printer/passport\_photo\_small.png](http://www.onthegosoft.com/images/printer/passport_photo_small.png)”/\>  
> &nbsp;&nbsp;&nbsp;&nbsp;\<h3\>Passport Photo\</h3\>  
> &nbsp;&nbsp;&nbsp;&nbsp;Our great program for making passport picture!  
> &nbsp;&nbsp;&nbsp;&nbsp;\<span class=“price”\>$9.95\</span\>
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br clear=“all”/\>  
> &nbsp;&nbsp;\</div\>  
> &nbsp;&nbsp;\<div class=“entry”\>  
> &nbsp;&nbsp;&nbsp;&nbsp;\<img  
> src=“[http://www.onthegosoft.com/images/photobackup/photo\_backup\_small.png](http://www.onthegosoft.com/images/photobackup/photo_backup_small.png)”/\>  
> &nbsp;&nbsp;&nbsp;&nbsp;\<h3\>Photo Backup\</h3\>  
> &nbsp;&nbsp;&nbsp;&nbsp;\<p\>\<b\>Great program\</b\> for backing up \<b\>digital photos\</b\>.\</p\>
> 
> &nbsp;&nbsp;&nbsp;&nbsp;\<span class="price"\>$29.95\</span\>
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br clear="all"/\>  
> &nbsp;&nbsp;\</div\>
> 
> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
> 
> Notice, just before the \<br\> tag at the end, a .js snippet should  
> appear, triggering the AJAX.  
> Any advice how I can debug this?
> 
> Thanks,  
> Amir

---

<div class="post-metadata">

**Author:** ![Philip\_Hallstrom](https://avatars.discourse-cdn.com/v4/letter/p/bbe5ce/32.png) [@Philip\_Hallstrom](https://rubytalk.org/u/Philip_Hallstrom)\
**Post date:** [25 October 2006 21:56 UTC](https://rubytalk.org/t/newbi-form-remote-tag-doesnt-produce-any-html/32323/2 "2006-10-25T21:56:57Z")

</div>

> I'm completely new to Ruby/Rails, so sorry for asking newbi questions.

You might get better luck asking the Rails list...

[http://groups.google.com/group/rubyonrails-talk?lnk=srg&hl=en](http://groups.google.com/group/rubyonrails-talk?lnk=srg&hl=en)

That said... see below.

> I'm just following the Agile Web Development book, and got to the AJAX  
> section.  
> Added the code from the web, to generate the .js which triggers the  
> AJAX, but no .js code appears in the HTML.
> 
> This is what I've added to the .rhtml code (from the book):  
> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> \<% for product in @products -%\>  
> \<div class="entry"\>  
> &nbsp;&nbsp;&nbsp;\<img src="\<%= product.image\_url %\>"/\>  
> &nbsp;&nbsp;&nbsp;\<h3\>\<%= h(product.title) %\>\</h3\>  
> &nbsp;&nbsp;&nbsp;\<%= product.description %\>  
> &nbsp;&nbsp;&nbsp;\<span class="price"\>\<%= number\_to\_currency(product.price) %\>\</span\>
> 
> &nbsp;&nbsp;&nbsp;\<% form\_remote\_tag :url =\> { :action =\> :add\_to\_cart, :id =\>  
> product } do %\>  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<%= submit\_tag "Add to Cart" %\>  
> &nbsp;&nbsp;&nbsp;\<% end %\>

I think form\_remote\_tag/do is edge rails... are you using edge? if you're not, change that, and don't forget to change "\<% form..." to "\<%= form...", so they actually output something.

> **···**
>
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br clear="all"/\>  
> > \</div\>  
> > \<% end %\>  
> > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
> > 
> > Surprisingly, the HTML source that I see in the browser doesn't contain  
> > any .js code. This is what I'm getting:  
> > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > \<div class="entry"\>  
> > &nbsp;&nbsp;&nbsp;\<img  
> > src="[http://www.onthegosoft.com/images/printer/passport\_photo\_small.png](http://www.onthegosoft.com/images/printer/passport_photo_small.png)"/\>  
> > &nbsp;&nbsp;&nbsp;\<h3\>Passport Photo\</h3\>  
> > &nbsp;&nbsp;&nbsp;Our great program for making passport picture!  
> > &nbsp;&nbsp;&nbsp;\<span class="price"\>$9.95\</span\>
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br clear="all"/\>  
> > \</div\>  
> > \<div class="entry"\>  
> > &nbsp;&nbsp;&nbsp;\<img  
> > src="[http://www.onthegosoft.com/images/photobackup/photo\_backup\_small.png](http://www.onthegosoft.com/images/photobackup/photo_backup_small.png)"/\>  
> > &nbsp;&nbsp;&nbsp;\<h3\>Photo Backup\</h3\>  
> > &nbsp;&nbsp;&nbsp;\<p\>\<b\>Great program\</b\> for backing up \<b\>digital photos\</b\>.\</p\>
> > 
> > &nbsp;&nbsp;&nbsp;\<span class="price"\>$29.95\</span\>
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br clear="all"/\>  
> > \</div\>
> > 
> > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
> > 
> > Notice, just before the \<br\> tag at the end, a .js snippet should  
> > appear, triggering the AJAX.  
> > Any advice how I can debug this?
> > 
> > Thanks,  
> > Amir
