how do I access the value of the field referenced in observe_field
from within my controller for the action specified?
I have a select with id “channelnotes” on it, to which I have an
observe_field that correctly works in calling channels.notesboxchange.
In my controller, I am trying to pick up the value of the select from
puts params[‘channelnotes’] and puts params[:channelnotes] and getting
nil, even when the select has text selected in it.
I must be doing something stoopid. Below is my .html.erb, as well as
the html/js produced by it. Thanks, Janna B.
<% form_for :associates, :html => {:name => ‘upsform’,:id =>
‘upsform’},:url=>{ :action =>“uplog_update_form”, :controller
=>“channels”} do |f| %>
Notes:
Subrata
Chakrabarty
Tiger
Software
India
<%= observe_field "channelnotes", :url => {:controller
=> :channels, :action => 'notesboxchange'} %>
Notes:
Subrata
Chakrabarty
Tiger
Software
India
//<![CDATA[
new Form.Element.EventObserver('channelnotes', function(element,
value) {new Ajax.Request('/channels/notesboxchange',
{asynchronous:true, evalScripts:true, parameters:value +
'&authenticity_token=' + encodeURIComponent('S7PkvbfwdF+Da2/
PbRUKW0YThoCF+qMynOAJyQoOi3c=')})})
//]]>
</script>
On Thu, 2009-07-09 at 12:43 -0700, JannaB wrote:
how do I access the value of the field referenced in observe_field
from within my controller for the action specified?
<%= observe_field “channelnotes”,
:url => {:controller=> :channels, :action => ‘notesboxchange’}
:with => whatever_you_want_the_parameter_key_to_be_named
%>
HTH,
Bill
THanks Bill, yes it works now as:
<%= observe_field “channelnotes”,