# Form Observers

**URL:** <https://www.ruby-forum.com/t/form-observers/91034>\
**Category:** Rails\
**Created:** [April 3, 2007, 11:21pm UTC](https://www.ruby-forum.com/t/form-observers/91034 "2007-04-03T23:21:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fred](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/db5fbb/32.png) [@fred](https://www.ruby-forum.com/u/fred)\
**Post date:** [April 3, 2007, 11:21pm UTC](https://www.ruby-forum.com/t/form-observers/91034/1 "2007-04-03T23:21:42Z")

</div>

Can anyone help me with this form observer?

I have a form in my page  
\<%= "

  
 .....   
" %\>

Followed by the observer  
\<%= observe\_form “notes\_#{id}”, :frequency =\> 2.5,  
:url =\> {:controller=\> ‘ajax\_test’, :action =\> ‘saveNote’} %\>

In the controller its simply  
def saveNote  
@a = params  
end

and in saveNote.rjs  
page.alert debug(@a)

when it saves the alert is  
alert("

```
— !map:HashWithIndifferentAccess
\naction: saveNotes\ncontroller: ajax\n
```
");

I had hoped to see something like  
monday\_id = …  
tuesday\_id = …  
and so on. Does anyone know why the data isn’t being sent?

---

<div class="post-metadata">

**Author:** ![fred](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/db5fbb/32.png) [@fred](https://www.ruby-forum.com/u/fred)\
**Post date:** [April 4, 2007, 4:01am UTC](https://www.ruby-forum.com/t/form-observers/91034/2 "2007-04-04T04:01:34Z")

</div>

Hi Fred,

Fred wrote:

> " %\>  
> I’m pretty sure that by hard-coding your html here, you’re not letting  
> Rails  
> know what it needs to know to generate the code you need from the  
> observe\_form method. I’d recommend you consult the form\_tag,  
> text\_field,  
> etc. methods at [api.rubyonrails.org](http://api.rubyonrails.org). Also, a scaffolded app in  
> yousandbox  
> would probably provide some good stuff to get your arms around how  
> things  
> work.

hth,  
Bill

hth,  
Bill

---

<div class="post-metadata">

**Author:** ![fred](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/db5fbb/32.png) [@fred](https://www.ruby-forum.com/u/fred)\
**Post date:** [April 5, 2007, 4:21pm UTC](https://www.ruby-forum.com/t/form-observers/91034/3 "2007-04-05T16:21:35Z")

</div>

Thanks for the help Bill.

I switched the tags to use the ruby code, which  
[http://www-128.ibm.com/developerworks/web/library/x-introajaxrails/index.html](http://www-128.ibm.com/developerworks/web/library/x-introajaxrails/index.html)  
has an example of using an observer as well.

---

<div class="post-metadata">

**Author:** ![fred](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/db5fbb/32.png) [@fred](https://www.ruby-forum.com/u/fred)\
**Post date:** [April 5, 2007, 5:26pm UTC](https://www.ruby-forum.com/t/form-observers/91034/4 "2007-04-05T17:26:05Z")

</div>

Hi Fred,

Fred wrote:

> Thanks for the help Bill.

You’re welcome.

> I switched the tags to use the ruby code, which  
> [http://www-128.ibm.com/developerworks/web/library/x-introajaxrails/index.html](http://www-128.ibm.com/developerworks/web/library/x-introajaxrails/index.html)  
> has an example of using an observer as well.

Glad you got it working. And thanks for providing the link. I’m sure  
that’ll save somebody else time in the future.

Best regards,  
Bill
