# Observer not working

**URL:** <https://www.ruby-forum.com/t/observer-not-working/140220>\
**Category:** Rails\
**Created:** [June 12, 2008, 12:56am UTC](https://www.ruby-forum.com/t/observer-not-working/140220 "2008-06-12T00:56:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![caltron](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@caltron](https://www.ruby-forum.com/u/caltron)\
**Post date:** [June 12, 2008, 12:56am UTC](https://www.ruby-forum.com/t/observer-not-working/140220/1 "2008-06-12T00:56:43Z")

</div>

I’m trying to observer a field (or form as in my example) and keep  
getting a ‘Form is not defined’ error. Near as I can tell everything is  
in place

In the layout file, I’ve got the default javascript files as one post  
mentioned they forgot

 test site
 \<%= @content\_for\_layout %\>
 \<%= javascript\_include\_tag :defaults %\> 

and in the demo.rhtml file

| Mon | \<%= text\_field("noteExpanded", "monday",:value =\> "") %\> |
| Tue | \<%= text\_field("noteExpanded", "tuesday", :value =\> "") %\> |
| Wed | \<%= text\_field("noteExpanded", "wednesday", :value =\> "") %\> |
| Thu | \<%= text\_field("noteExpanded", "thursday", :value =\> "") %\> |
| Fri | \<%= text\_field("noteExpanded", "friday", :value =\> "") %\> |

\<%= observe\_form “daily\_notes”, :frequency =\> 2.0,  
:url =\> {:controller =\> ‘assignments’, :action =\> ‘saveNotes’},  
:update =\> “”  
%\>

---

<div class="post-metadata">

**Author:** ![caltron](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@caltron](https://www.ruby-forum.com/u/caltron)\
**Post date:** [June 12, 2008, 11:16pm UTC](https://www.ruby-forum.com/t/observer-not-working/140220/2 "2008-06-12T23:16:20Z")

</div>

I’ve been playing around and have got the following code will work in a  
specific scenario, but other attempts just fail.

 \<%= observe\_field "test1", :frequency =\> 2.0, :url =\> {:controller =\> 'assignments', :action =\> 'test'}, :update =\> "" %\>

If I drop that into a page, it fails, if I have it as a partial and have  
the page include it on load, it also fails.

BUT if I have it as a partial, have a link that calls back to the  
controller and does a  
page.insert\_html :bottom, “main”, :partial =\> ‘/assignments/testNote’

then it works. Anyone have any idea why it only works in such a limited  
fashion? I
