Hello, I''m using the ''button_to'' helper in the following syntax: <td><%= button_to "Delete", { :action => "destroy", :id => user.id }, :confirm => "Are you sure?", :method => :delete, :class => ''submitLink'' %></td> However, the confirmation is not working, its going straight to the destroy action in the controller w/out confirming with the user in a popup. Any ideas? Dave -- 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.
loominator1970 wrote in post #962212:> Hello, > > I''m using the ''button_to'' helper in the following syntax: > > <td><%= button_to "Delete", { :action => "destroy", :id => user.id }, > :confirm => "Are you sure?", :method => :delete, :class => > ''submitLink'' %></td> > > However, the confirmation is not working, its going straight to the > destroy action in the controller w/out confirming with the user in a > popup. Any ideas? >Is JavaScript turned on in your browser?> DaveBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- 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.
> Is JavaScript turned on in your browser?Yes, I have jQuery and protoype enabled in the application.html.erb page. -- 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.
On 17 November 2010 21:47, loominator1970 <loominator1970-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> >> Is JavaScript turned on in your browser? > > Yes, I have jQuery and protoype enabled in the application.html.erb > page.Is that "Yes I have JavaScript turned on in the browser _and_ I have jQuery and prototype enabled in application.html.erb" or "Yes, I have jQuery and protoype enabled in the application.html.erb and I didn''t actually understand what you meant by Javascript turned on in the browser"? If the former then have you checked the html to see if it is what you expect (View, Page Source or similar in browser) and it might be worth checking the html for validity by pasting the complete page html into the w3c html validator. Colin -- 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.
Actually, its C. "I''m a dumba$$ and didn''t read your question carefully enough :)" Javascript IS turned on in my browser and enabled in my app. I will follow you suggestion and try that route. Thanks for the help! On Nov 17, 2:56 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 17 November 2010 21:47, loominator1970 <loominator1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > >> Is JavaScript turned on in your browser? > > > Yes, I have jQuery and protoype enabled in the application.html.erb > > page. > > Is that "Yes I have JavaScript turned on in the browser _and_ I have > jQuery and prototype enabled in application.html.erb" or > "Yes, I have jQuery and protoype enabled in the application.html.erb > and I didn''t actually understand what you meant by Javascript turned > on in the browser"? > > If the former then have you checked the html to see if it is what you > expect (View, Page Source or similar in browser) and it might be worth > checking the html for validity by pasting the complete page html into > the w3c html validator. > > Colin-- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hello, Is any method associated with it i your controller? like: def destroy @user.destroy redirect_to.... end For first shot for me it seems to be the problem, not JavaScript. Anyway I suggest Firebug to see if any JavaScript bug. Let me know if further problem with it, good luck gezope On nov. 18, 03:50, loominator1970 <loominator1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Actually, its C. "I''m a dumba$$ and didn''t read your question > carefully enough :)" Javascript IS turned on in my browser and > enabled in my app. I will follow you suggestion and try that route. > Thanks for the help! > > On Nov 17, 2:56 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > > > > > > > > On 17 November 2010 21:47, loominator1970 <loominator1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > >> Is JavaScript turned on in your browser? > > > > Yes, I have jQuery and protoype enabled in the application.html.erb > > > page. > > > Is that "Yes I have JavaScript turned on in the browser _and_ I have > > jQuery and prototype enabled in application.html.erb" or > > "Yes, I have jQuery and protoype enabled in the application.html.erb > > and I didn''t actually understand what you meant by Javascript turned > > on in the browser"? > > > If the former then have you checked the html to see if it is what you > > expect (View, Page Source or similar in browser) and it might be worth > > checking the html for validity by pasting the complete page html into > > the w3c html validator. > > > Colin-- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Zoltan Gero wrote in post #962389:> Hello, > > Is any method associated with it i your controller? like: > def destroy > @user.destroy > redirect_to.... > end > > For first shot for me it seems to be the problem, not JavaScript.No. The problem is that for some reason the JavaScript is not being generated, or at least not firing, as expected. To the OP: do you see the generated JS in the page source? Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- 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.
Thanks for all the input, turns out I didn''t have my javascript ducks in a row, since I''m a JS newb. I''m going with an all jquery solution, and I needed to do the following things: # in the layouts/application.html.erb # remove the line <%= javascript_include_tag :defaults %> # and add.... <%= javascript_include_tag ''jquery-1.4.3.js'', ''rails'', ''application'' %> and in my public/javascripts directory add ''jquery-1.4.3.js'' and ''rails.js'' (from https://github.com/rails/jquery-ujs) Works like a dream now! Dave On Nov 18, 12:16 pm, Marnen Laibow-Koser <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Zoltan Gero wrote in post #962389: > > > Hello, > > > Is any method associated with it i your controller? like: > > def destroy > > -P7VYnuqUy3mv9pIUa/Yw3w@public.gmane.org > > redirect_to.... > > end > > > For first shot for me it seems to be the problem, not JavaScript. > > No. The problem is that for some reason the JavaScript is not being > generated, or at least not firing, as expected. > > To the OP: do you see the generated JS in the page source? > > Best, > -- > Marnen Laibow-Koserhttp://www.marnen.org > mar...-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > > -- > Posted viahttp://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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
loominator1970 wrote in post #964587:> and in my public/javascripts directory > add ''jquery-1.4.3.js'' and ''rails.js'' (from > https://github.com/rails/jquery-ujs) > > Works like a dream now! > > DaveI do as you do, however, it did not work. At last, i use this: <%= button_to "del", @you, {:onclick => "return confirm(''Are you sure?'')", :method => :delete}%> to solve the problem. And this solution is from http://stackoverflow.com/questions/6602520/confirm-and-method-not-working-in-rails-button-to -- 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.