|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
observe_field value in controllerhow 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| %> <div id="notesdiv" style="float: right;"> Notes: <SELECT name="channelnotes" id="channelnotes" style="width: 350px; onKeyDown="fnKeyDownHandler(this, event);" onKeyUp="fnKeyUpHandler_A(this, event); return false;" onKeyPress = "return fnKeyPressHandler_A(this, event);" onChange="fnChangeHandler_A (this, event);"> <OPTION value="" style="COLOR:#ff0000;BACKGROUND-COLOR:#ffff00;"></ OPTION> <option>Subrata</option> <option>Chakrabarty</option> <option>Tiger</option> <option>Software</option> <option>India</option> </SELECT> </div> <%= observe_field "channelnotes", :url => {:controller => :channels, :action => 'notesboxchange'} %> <form action="/channels/uplog_update_form" id="upsform" method="post" name="upsform"><div style="margin:0;padding:0"><input name="authenticity_token" type="hidden" value="S7PkvbfwdF+Da2/ PbRUKW0YThoCF+qMynOAJyQoOi3c=" /></div> <div id="notesdiv" style="float: right;"> Notes: <SELECT name="channelnotes" id="channelnotes" style="width: 350px; onKeyDown="fnKeyDownHandler(this, event);" onKeyUp="fnKeyUpHandler_A(this, event); return false;" onKeyPress = "return fnKeyPressHandler_A(this, event);" onChange="fnChangeHandler_A (this, event);"> <OPTION value="" style="COLOR:#ff0000;BACKGROUND-COLOR:#ffff00;"></ OPTION> <option>Subrata</option> <option>Chakrabarty</option> <option>Tiger</option> <option>Software</option> <option>India</option> </SELECT> </div> <script type="text/javascript"> //<![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> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@... To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@... For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: observe_field value in controllerOn 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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@... To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@... For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: observe_field value in controllerTHanks Bill, yes it works now as: <%= observe_field "channelnotes", > :url => {:controller=> :channels, :action => 'notesboxchange'} , :with => 'whatever_you_want_the_parameter_key_to_be_named' --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@... To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@... For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~--- |
| Free embeddable forum powered by Nabble | Forum Help |