# RJS sporadic error message

**URL:** <https://www.ruby-forum.com/t/rjs-sporadic-error-message/165992>\
**Category:** Rails\
**Created:** [April 20, 2009, 7:26pm UTC](https://www.ruby-forum.com/t/rjs-sporadic-error-message/165992 "2009-04-20T19:26:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![snantz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c2a13f/32.png) [@snantz](https://www.ruby-forum.com/u/snantz)\
**Post date:** [April 20, 2009, 7:26pm UTC](https://www.ruby-forum.com/t/rjs-sporadic-error-message/165992/1 "2009-04-20T19:26:57Z")

</div>

I have this form that allows a user to enter a username and save it,  
assocciating your profile with theirs via an id. A list gets updated and  
a partial is displayed. The problem is that when I hit the submit button  
to this form to make this all happened I (sometimes, but more often then  
not) get an RJS error that reads:  
TypeError: Cannot set property ‘innerHTML’ of bull.  
I hot OK and another error pops up giving me this long string of what  
appears to be JavaScript or Ajax code?

Main View Code:

Travel Arranger Pages  
  
**The profiles for which you are responsible**   

* * *

 \<%= render :partial =\> 'show\_my\_users' %\> 

* * *
  

 \<%= render :partial =\> 'add\_new\_profile' %\> 

Partial - add\_new\_profile:  
\<% form\_remote\_tag :url =\> {:action =\> ‘add\_profile\_auto’, :id =\>  
@user.id },  
:complete =\> “new Effect.Appear(‘airport’); new  
Effect.Pulsate(‘airport’);”  
do -%\>  
**Type in username to add to your list:**   
  
\<%= text\_field\_with\_auto\_complete :user, :username,  
{:value =\> ‘’, :size =\> 45},  
{:url =\> { :action =\> “auto\_complete\_for\_user\_username”,  
:id =\> @user.primary\_account\_id },  
:skip\_style =\> true} %\>  
\<%= submit\_tag ‘Add Name’%\>  
\<% end -%\>  
…

Controller code - add\_profile\_auto:  
…  
render :update do |page|  
page.replace\_html ‘travel-managers-users’, :partial =\>  
‘show\_my\_users’  
page.replace\_html ‘company\_users’, :partial =\> ‘add\_new\_profile’  
end  
…

Any ideas of why I am getting this error. I am just lost. Like I said I  
sometimes get the error and sometimes I don’t.

Thanks in advance,

-S

---

<div class="post-metadata">

**Author:** ![snantz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c2a13f/32.png) [@snantz](https://www.ruby-forum.com/u/snantz)\
**Post date:** [April 24, 2009, 4:47pm UTC](https://www.ruby-forum.com/t/rjs-sporadic-error-message/165992/2 "2009-04-24T16:47:32Z")

</div>

Hi Shandy,

On Mon, 2009-04-20 at 19:26 +0200, Shandy N. wrote:

> I have this form that allows a user to enter a username and save it,  
> assocciating your profile with theirs via an id. A list gets updated and  
> a partial is displayed. The problem is that when I hit the submit button  
> to this form to make this all happened I (sometimes, but more often then  
> not) get an RJS error that reads:  
> TypeError: Cannot set property ‘innerHTML’ of bull.  
> I hot OK and another error pops up giving me this long string of what  
> appears to be JavaScript or Ajax code?

I’ve never seen this myself but can offer some general info / advice.

In reverse order, yes. What you’re seeing in the error dialog is the  
javascript that was being attempted when the error was encountered.

The fact that you’re getting a ‘TypeError’, and the error itself is  
telling you that bull doesn’t have the property you’re trying to set.  
It looks like you’re using replace\_html on something that has no html  
‘insides’. For example…

assuming:

 \<img id="bull" src="bull.png /\> \</div\> \<p\>this will work:\<br\> page.replace\_html “bull\_ring”, “new\_image.png”\</p\> \<p\>this will not:\<br\> page.replace\_html “bull”, “new\_image.png”\</p\> \<p\>I’d start by taking a look at the HTML in Firebug prior to hitting the\<br\> submit and compare what’s there with what you need wrt your RJS.\</p\> \<p\>HTH,\<br\> Bill\</p\>
