Rails: link_to_remote prototype helper with :with option
Posted
by Syed Aslam
on Stack Overflow
See other posts from Stack Overflow
or by Syed Aslam
Published on 2010-03-31T11:26:54Z
Indexed on
2010/03/31
12:33 UTC
Read the original article
Hit count: 335
ruby-on-rails
I am trying to grab the current value of a drop down list with Prototype and passing it along using :with like this
<%= link_to_remote "today", :update => "choices",
:url => { :action => "check_availability" } ,
:with => "'practitioner='+$F('practitioner')&'clinic='+$F('clinic')&'when=today'",
:loading => "spinner.show(); $('submit').disable();",
:complete => "spinner.hide(); $('submit').enable();" %>
However, this is not working as expected. I am unable to access parameters in the controller as the link_to_remote helper is sending parameters like this:
Parameters: {"succ"=>"function () {\n return this + 1;\n}", "action"=>"check_availability", "round"=>"function () {\n return __method.apply(null, [this].concat($A(arguments)));\n}", "ceil"=>"function () {\n return __method.apply(null, [this].concat($A(arguments)));\n}", "floor"=>"function () {\n return __method.apply(null, [this].concat($A(arguments)));\n}", "times"=>"function (iterator, context) {\n $R(0, this, true).each(iterator, context);\n return this;\n}", "toPaddedString"=>"function (length, radix) {\n var string = this.toString(radix || 10);\n return \"0\".times(length - string.length) + string;\n}", "toColorPart"=>"function () {\n return this.toPaddedString(2, 16);\n}", "abs"=>"function () {\n return __method.apply(null, [this].concat($A(arguments)));\n}", "controller"=>"main"}
Where am I going wrong? Is there a better way to do this?
© Stack Overflow or respective owner