# Help with observer\_form , javascript error

**URL:** <https://www.ruby-forum.com/t/help-with-observer-form-javascript-error/71929>\
**Category:** Rails\
**Created:** [October 12, 2006, 1:36pm UTC](https://www.ruby-forum.com/t/help-with-observer-form-javascript-error/71929 "2006-10-12T13:36:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zanoni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e99b99/32.png) [@zanoni](https://www.ruby-forum.com/u/zanoni)\
**Post date:** [October 12, 2006, 1:36pm UTC](https://www.ruby-forum.com/t/help-with-observer-form-javascript-error/71929/1 "2006-10-12T13:36:19Z")

</div>

I’ve set up an observer form, it is not working nor throwing error at  
least  
in loading the page.  
The Firefox javascript console is showing this error:

Error: missing } after property list  
Source File: [http://localhost:3000/ajaxsearch/list](http://localhost:3000/ajaxsearch/list)  
Line: 165, Column: 45  
Source Code:  
hide(‘roller’)}, parameters:‘Form.serialize(‘asearch’)=’ + value})})

I think it’s telling me I’m missing a { (brace) , though I’m not 100%  
sure  
about that. The page source for the javascript it points too is:

new Form.Observer(‘asearch’, 1, function(element, value)  
{Element.show(‘roller’);  
new Ajax.Updater(‘table’, ‘/ajaxsearch/list’, {asynchronous:true,  
evalScripts:true, onComplete:function(request){Element.show(‘table’)},  
onSuccess:function(request){Element.hide(‘roller’)}, parameters:’  
Form.serialize(‘asearch’)=’ + value})})

The page is loading the partial but is not effected by any of the  
options  
selected in the form.  
Not sure what is wrong , but here is the form and observe\_form as it’s  
written:

\<% start\_form\_tag(:action =\> “livesearch”,  
:id =\> “asearch”) %\>

Category \<%= options\_from\_collection\_for\_select @categories, :id, :name %\> State \<%= options\_from\_collection\_for\_select @states, :id, :name %\> Terms \<%= options\_from\_collection\_for\_select @terms, :id, :name %\> Title City

\<%= submit\_tag ‘livesearch’ %\>  
\<% end\_form\_tag %\>

\<%= image\_tag(“roller.gif”,  
:align =\> ‘absmiddle’,  
:border =\> 0,  
:id =\> “roller”,  
:style =\> “display: none;”) %\>

\<%= observe\_form “asearch”,  
:frequency =\> 1,  
:before =\> “Element.show(‘roller’)”,  
:success =\> “Element.hide(‘roller’)”,  
:with =\> “Form.serialize(‘asearch’)”,  
:complete =\> “Element.show(‘table’)”,  
:url =\> { :action =\> ‘list’ } %\>

\<%= render :partial =\> 'positions\_list', :layout =\> false %\>

–

> **[Dark ambient](https://en.wikipedia.org/wiki/Dark_ambient)**
>
> Dark ambient (referred to as ambient industrial especially in the 1980s) is a genre of post-industrial music that features an ominous, dark droning and often gloomy, monumental or catacombal atmosphere, partially with discordant overtones. It shows similarities with ambient music, a genre that has been cited as a main influence by many dark ambient artists, both conceptually and compositionally. Although mostly electronically generated, dark ambient also includes the sampling of hand-pla 
> The te...

---

<div class="post-metadata">

**Author:** ![zanoni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e99b99/32.png) [@zanoni](https://www.ruby-forum.com/u/zanoni)\
**Post date:** [October 12, 2006, 3:30pm UTC](https://www.ruby-forum.com/t/help-with-observer-form-javascript-error/71929/2 "2006-10-12T15:30:05Z")

</div>

Hi there,

Yup, you’ve got a syntax error in your javascript. You might try the  
Vinkman JS debugger for mozilla. Then you can trace it back to whatever  
generated that code.

I didn’t check your code thoroughly, but it could be an escaping  
problem.

starr

---

<div class="post-metadata">

**Author:** ![zanoni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e99b99/32.png) [@zanoni](https://www.ruby-forum.com/u/zanoni)\
**Post date:** [October 18, 2006, 10:38am UTC](https://www.ruby-forum.com/t/help-with-observer-form-javascript-error/71929/3 "2006-10-18T10:38:39Z")

</div>

Well I straightened the form and checked it in firebug so it looks well  
now.  
I think my problem right now is the params aren’t being passed correctly  
into the action. Maybe someone could help this clueless noob out and  
tell  
me what I’m doing wrong -

# This is one element in the form - \<select name=position[category\_id][] size = “4” multiple = “multiple” id

‘cat’\>\<%=  
options\_from\_collection\_for\_select @categories, :id, :name  
%\>

In the controller I passed params[:position][category\_id] but it’s  
coming up  
nil.[]

Thanks  
Stuart

On 10/12/06, Starr [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> starr
> 
> >

–

> **[Dark ambient](https://en.wikipedia.org/wiki/Dark_ambient)**
>
> Dark ambient (referred to as ambient industrial especially in the 1980s) is a genre of post-industrial music that features an ominous, dark droning and often gloomy, monumental or catacombal atmosphere, partially with discordant overtones. It shows similarities with ambient music, a genre that has been cited as a main influence by many dark ambient artists, both conceptually and compositionally. Although mostly electronically generated, dark ambient also includes the sampling of hand-pla 
> The te...

---

<div class="post-metadata">

**Author:** ![zanoni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e99b99/32.png) [@zanoni](https://www.ruby-forum.com/u/zanoni)\
**Post date:** [October 18, 2006, 10:38am UTC](https://www.ruby-forum.com/t/help-with-observer-form-javascript-error/71929/4 "2006-10-18T10:38:41Z")

</div>

Never mind I got the params in correctly. My only problem is it’s not  
generating the partial anymore 🙂

Stuart

On 10/12/06, Dark A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> %\>
> 
> > > >
> 
> –  
> [Dark ambient - Wikipedia](http://en.wikipedia.org/wiki/Dark_ambient)

–

> **[Dark ambient](https://en.wikipedia.org/wiki/Dark_ambient)**
>
> Dark ambient (referred to as ambient industrial especially in the 1980s) is a genre of post-industrial music that features an ominous, dark droning and often gloomy, monumental or catacombal atmosphere, partially with discordant overtones. It shows similarities with ambient music, a genre that has been cited as a main influence by many dark ambient artists, both conceptually and compositionally. Although mostly electronically generated, dark ambient also includes the sampling of hand-pla 
> The te...
