Help with observer_form , javascript error

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
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 %>


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

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 [email protected] wrote:

starr


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

Stuart

On 10/12/06, Dark A. [email protected] wrote:

%>


http://en.wikipedia.org/wiki/Dark_ambient


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs