Amit Tomar wrote in post #955655:
> Hii all ,
>
>           I am trying to create a button that, when clicked on, calls a
> method in a controller . I am thinking that button_to_function is good
> to use for that i made htnl viwe like
>
> <h1>File Upload</h1>
>
> <p><label for="upload_file">Select File</label> :
> <%= file_field 'upload', 'datafile' %></p>
> <%= button_to_function  "UploadFile","alert('Hello world!')"%>
> <%=button_to_function 'upload', remote_function({:action
> =>'uploadFile'}, :controller => 'UploadController') %>
>
> but when i clicked on upload button nothing happen could anyone suggest
> me how to this

Hi

You can use button_to_function with remote_function like

 <%= button_to_function 'Click me', remote_function(:url=>{:action =>
'uploadFile', :controller => 'UploadController'}} =>

remote_function is same options as link_to_remote and generates the an
ajax call. You'll want to read about rjs for the final step of your
problem


Good Luck ;)
-Ganesh K

-- 
Posted via http://www.ruby-forum.com/.

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to