Replace link_to_remote bu button_to_function

Hi,

I am making use of a method button_to_function, and I want to use it in
place of link_to_remot.

The issue I am facing is that I am not able to pass all the parameters
of the remote function to button function.

I am sending both the code pieces…

<%= link_to_remote(‘Go’,
:condition=>“btn_disable(),checkNotSpecialCharacter() !=
false” ,
:url => { :action => ‘find’ } ,
:with =>"‘search=’+$(‘search’).value+’&single_select=true’",
:method => ‘get’,
:update => ‘list_table’) %>

  <%= button_to_function 'Go',
                                 "openWin('#{url_for(
                                 :action => 'find',
         :method => 'get',
         :with

=>"‘search=’+$(‘search’).value+’&structural_unit=default’",
:update => ‘list_table’,
:condition=>“btn_disable(),checkNotSpecialCharacter() !=
false” )}’)",
:class=>‘n25x24’ %>

The main problem being that The search functionality and the condition
are not functioning .

Thank You

I believe you want

submit_to_remote

Which works just like link_to_remote.

submit_to_remote(name, value, options = {})

Returns a button input tag that will submit form using XMLHttpRequest in
the
background instead of regular reloading POST arrangement. options
argument
is the same as in
form_remote_taghttp://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper.html#M000535.

On Nov 27, 2007 6:44 AM, Advait B.
[email protected]

Brian H. wrote:

I believe you want

submit_to_remote

Which works just like link_to_remote.

submit_to_remote(name, value, options = {})

Returns a button input tag that will submit form using XMLHttpRequest in
the
background instead of regular reloading POST arrangement. options
argument
is the same as in
form_remote_taghttp://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper.html#M000535.

On Nov 27, 2007 6:44 AM, Advait B.
[email protected]

Hi,

Thank you very much, the submit to remote function is working fine the
way I want it to work, but the button which I am making use has a :class
=> ’ ’ which gives the button a distinct look, how could I include this.

<%= submit_to_remote ‘GoBtn’,‘Go’,
:url =>{ :action => ‘find’},
:with
=>“‘search=’+$(‘search’).value+‘&structural_unit=default’”,
:update => ‘list_table’,
:condition=>“btn_disable(),checkNotSpecialCharacter() !=
false”,
:method => ‘get’ %>

I need to include the :class => ‘redbt80x80’, for the button to display
a red color, how could I include this

Thank you

advait