Questions tagged [button-to]

67 questions
0
votes
0 answers

Why button show disabled in browser without any code set in html.erb file?

In proj.html.erb file, I have code like below which has no disable feature, but in browser, it is disabled. I am wondering why? I haven't set it in anywhere, there is also other buttons in the same container that works fine. In proj.html.erb:
Dong Jin
  • 21
  • 4
0
votes
1 answer

why is button_to not working with method: :put with slim in rails

I want to trigger a put method for voting with emojis but button_to is not working with slim in rails I have the following: = button_to vote_backend_session_path(@session.id, emoji: emoji), method: :put, remote: true, class: "btn btn-vote btn-xs…
OuttaSpaceTime
  • 710
  • 10
  • 24
0
votes
1 answer

Rails destroy action doesn't work with button_to

I am a beginner in Rails and currently I am working on my project.The idea is, that when user buy something for someone, it can create a transaction with informations such us: for who it bought, how much it spent and finally a short description of…
L.Wini
  • 67
  • 1
  • 7
0
votes
2 answers

Sending parameters through button on rails form_tag with put method

I have two links ( could be buttons if needed ) that say accept and decline and I need to send true or false parameters to my controller action by clicking one of those links. I don't want my parameters to be visible in the url so I need to use put…
mara
  • 39
  • 1
  • 5
0
votes
2 answers

Not sure why strong params isn't working - param is missing or the value is empty:

hoping someone can help. I've been searching through other "param is missing" questions, but can't seem to figure out what's wrong. In my routes file I have this nested resource "actions" resources :jobs do resources :actions end The associated…
0
votes
1 answer

Why is Rails button_to designation ignoring my method speicifcation?

I’m using Rails 4.2.7. I’m trying to create a button with a GET submit method, so I created <%= button_to "Save", user_my_object_time_matches_create_path(:id => @my_object_time.id), :method => "GET", :class => 'btn…
Dave
  • 15,639
  • 133
  • 442
  • 830
0
votes
1 answer

rails `button_to` nested params not formatted correctly

I have a controller action def create @subject_decision = SubjectDecision.new(subject_decision_params) respond_to do |format| if @subject_decision.save format.html { redirect_to @subject_decision, notice: 'Subject decision…
Shawnzam
  • 327
  • 2
  • 11
0
votes
1 answer

How do I create a button that simply redirects without submitting my form?

I’m using Rails 4.2.7. I want to add a “Cancel” button on my form that will simply direct the user to another part of the application. So I implemented <%= button_to "Cancel", {:controller => :my_objects, :action => 'index' }, :class => 'btn'…
Dave
  • 15,639
  • 133
  • 442
  • 830
0
votes
2 answers

button_to creates non-clickable button

I've noticed an odd behavior with button_to. I have some stylized buttons. When button_to is generated the input submit field is placed inside the button element. What ends up happening is that the inner edges of the button when clicked do not…
thank_you
  • 11,001
  • 19
  • 101
  • 185
0
votes
0 answers

Rails 4 Invalid authenticity token when saving param through link

I have a Message model that has an archived param in my Rails 4 app. In the show view, I have a button_to that sets the archived param to true. This function previously worked before I added Devise and a Mailer to the Message model. Now, when I…
0
votes
2 answers

Rails, check condition when user click button_to

I'm doing an application for booking movie. For each movie have a "book" button, normally it just direct to another page handled by a controller. But is there any way to do like this? if user not login before, show a popup to redirect to login page,…
Phu Tang
  • 415
  • 6
  • 16
0
votes
1 answer

Adding class to button_to in Rails not working

I'm trying to add a class with button_to in Rails, but I keep getting syntax errors. This is what I've got: <%= button_to "Update this task", user_task_path(current_user, task), method: "patch", remote: true, {class: "update"} %> I've tried putting…
jslutzky
  • 419
  • 1
  • 5
  • 10
0
votes
2 answers

Add a custom textfield to button_to in addition to data

I have a button_to called 'DELETE' within which I have added data: { confirm: "Are you sure you want to delete?" } I also wish to add a custom textfield asking the user for appropriate reason before deletion and then store it consequently. Can I…
aayush_v20
  • 191
  • 1
  • 2
  • 8
0
votes
1 answer

Ruby on rails: Button_to Check post result and update current page

In my UI, I have a table of items. Each row has a favorite button. I am using button to make a rails call to add the db association. I've been looking into how to check the result of the post response in my button to call. If it succeeds, I want to…
Sakib
  • 1,503
  • 4
  • 26
  • 39
0
votes
0 answers

Ruby on Rails 4 - Button_to doesn't work as intended

I have a table for challenges which the user can accept or decline and I can't get it to work properly. When the user clicks on the accept button he should get a notice that the challenge was accepted (doesn't work - its always not accepted) and the…