Hello,
I’m using the ‘button_to’ helper in the following syntax:
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
Hello,
I’m using the ‘button_to’ helper in the following syntax:
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
Is JavaScript turned on in your browser?
Yes, I have jQuery and protoype enabled in the application.html.erb
page.
loominator1970 wrote in post #962212:
Hello,
I’m using the ‘button_to’ helper in the following syntax:
<%= button_to "Delete", { :action => "destroy", :id => user.id }, :confirm => "Are you sure?", :method => :delete, :class => 'submitLink' %>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?
Dave
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
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 17 November 2010 21:47, loominator1970 [email protected]
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
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
Zoltan Gero wrote in post #962389:
Hello,
Is any method associated with it i your controller? like:
def destroy
@user.destroy
redirect_to…
endFor 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?
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
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:
<%= 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
GitHub - rails/jquery-ujs: Ruby on Rails unobtrusive scripting adapter for jQuery)
Works like a dream now!
Dave
loominator1970 wrote in post #964587:
and in my public/javascripts directory
add ‘jquery-1.4.3.js’ and ‘rails.js’ (from
GitHub - rails/jquery-ujs: Ruby on Rails unobtrusive scripting adapter for jQuery)Works like a dream now!
Dave
I 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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs