Observer not working for checkbox

Hi,

My code is like this:
<%= check_box_tag(“criteria[#{count}][data_auto_complete]”, “1”,true)
%>Private

<%= observe_field(“criteria[#{count}][data_auto_complete]”,
:url => { :action =>
:choose_auto_complete_selection, :type_id => type_id, :count => count,
:report_key => report_key, :rcolumn => rcolumn, :data_elem => @data_elem
},
:before =>
“Element.show(‘indicator_choose_select_all_#{count}’)”,
:success =>
“Element.hide(‘indicator_choose_select_all_#{count}’);
document.getElementById(’_commit’).disabled =false;”,
:with => “‘value=’+value”) %>

But the observer is not firing when i change the state of the check box.

Another thing is that this code is coming in a partial that is rendered
in a window created using extjs new Window.

Any suggestions why the observer wont work but the onclick event works.

It may be redundant, but you might try adding:
:on=>‘click’
:frequency=>0.25

onClick is supposed to be the default for check boxes but it won’t
hurt to make it explicit. If that doesn’t help, setting the frequency
will make the detection time-based rather than event-based and help
make sure the change in value is detected.

On May 16, 11:25 am, Neha C. [email protected]

Still it didn’t work…
AndyV wrote:

It may be redundant, but you might try adding:
:on=>‘click’
:frequency=>0.25

onClick is supposed to be the default for check boxes but it won’t
hurt to make it explicit. If that doesn’t help, setting the frequency
will make the detection time-based rather than event-based and help
make sure the change in value is detected.

On May 16, 11:25 am, Neha C. [email protected]

Have you checked the rendered HTML to see if it looks to be correct
and the id’s are matching up the way you expect? If those are
matching then my guess would be that the js itself has an error.
Check it in FF w/Firebug.

On May 16, 12:14 pm, Neha C. [email protected]

AndyV wrote:

Have you checked the rendered HTML to see if it looks to be correct
and the id’s are matching up the way you expect? If those are
matching then my guess would be that the js itself has an error.
Check it in FF w/Firebug.

On May 16, 12:14 pm, Neha C. [email protected]

Here is the javascript that is getting generated:

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