# TypeError: html has no properties

**URL:** <https://www.ruby-forum.com/t/typeerror-html-has-no-properties/112239>\
**Category:** Rails\
**Created:** [August 16, 2007, 6:21pm UTC](https://www.ruby-forum.com/t/typeerror-html-has-no-properties/112239 "2007-08-16T18:21:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Glen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8c91f0/32.png) [@Glen](https://www.ruby-forum.com/u/Glen)\
**Post date:** [August 16, 2007, 6:21pm UTC](https://www.ruby-forum.com/t/typeerror-html-has-no-properties/112239/1 "2007-08-16T18:21:38Z")

</div>

I’m trying to update a div after form submission, for some reason it  
is dying on this line:

render :update do |page|  
page[:body].replace\_html :url =\> body\_report\_show(:id =\>  
params[:report\_id])  
end

I get an alert window that says

RJS error:

TypeError: html has no properties

Help??

---

<div class="post-metadata">

**Author:** ![Glen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8c91f0/32.png) [@Glen](https://www.ruby-forum.com/u/Glen)\
**Post date:** [August 16, 2007, 6:33pm UTC](https://www.ruby-forum.com/t/typeerror-html-has-no-properties/112239/2 "2007-08-16T18:33:42Z")

</div>

Typically that means that there is not an element on the page with that  
id.

Glen wrote:

> RJS error:
> 
> TypeError: html has no properties
> 
> Help??
> 
> >

–  
Sincerely,

William P.

[http://www.billpratt.net](http://www.billpratt.net)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![Glen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8c91f0/32.png) [@Glen](https://www.ruby-forum.com/u/Glen)\
**Post date:** [August 16, 2007, 6:35pm UTC](https://www.ruby-forum.com/t/typeerror-html-has-no-properties/112239/3 "2007-08-16T18:35:42Z")

</div>

To clarify, look at you source html and make sure there is an element on  
the page that has ‘body’ as it’s id. i.e.:

William P. wrote:

> > end

–  
Sincerely,

William P.

[http://www.billpratt.net](http://www.billpratt.net)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![Glen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8c91f0/32.png) [@Glen](https://www.ruby-forum.com/u/Glen)\
**Post date:** [August 16, 2007, 6:47pm UTC](https://www.ruby-forum.com/t/typeerror-html-has-no-properties/112239/4 "2007-08-16T18:47:43Z")

</div>

It should still be there. At this point in the application that div  
has been updated at least twice but I don’t use replace anywhere.

Is there a way to pass data forward so that I could test with  
rendering a partial? I would need to set the @report variable again  
somehow for the partial.

---

<div class="post-metadata">

**Author:** ![Glen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8c91f0/32.png) [@Glen](https://www.ruby-forum.com/u/Glen)\
**Post date:** [August 16, 2007, 6:57pm UTC](https://www.ruby-forum.com/t/typeerror-html-has-no-properties/112239/5 "2007-08-16T18:57:44Z")

</div>

The only other thing that immediately comes to mind is to validate your  
html after the last successful update to make sure it didn’t break.  
Since JS depends on a “mostly” valid dom, that could be it. If you are  
using Firefox, the web developer tool bar has the ability to validate  
local html and also the ability to view the “generated source” which  
will show the source for the page after js has modified it.

For rendering as a partial, you can either directly access @report in  
the partial, or decouple the partial by setting a local variable like  
this:

render :update do |page|  
page[:body].replace\_html :partial =\> ‘a\_partial’, :locals =\> {:report  
=\> @report}  
end

This would set the local variable “report” in the partial to the value  
of @report.

Hope this helps.

Glen wrote:

> > the page that has ‘body’ as it’s id. i.e.:
> > 
> > > > I’m trying to update a div after form submission, for some reason it
> > 
> > removed\_email\_address@domain.invalid
> 
> >

–  
Sincerely,

William P.

[http://www.billpratt.net](http://www.billpratt.net)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![Glen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8c91f0/32.png) [@Glen](https://www.ruby-forum.com/u/Glen)\
**Post date:** [August 16, 2007, 6:59pm UTC](https://www.ruby-forum.com/t/typeerror-html-has-no-properties/112239/6 "2007-08-16T18:59:44Z")

</div>

Thanks, William.

I actually just got done doing the latter and it is working now. The  
code is getting a bit sloppy, I really need to go through and clean it  
up.

Thanks again for your help.
