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 -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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 thisHi 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Ganesh Kathare wrote in post #955659:> 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> >>Thanks Ganesh i don''t but its working for me Actully in my rails application i displayed a messagebox using win32api but i am not to produce it at client site do you have any idea how should i do that -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.