Questions tagged [remote-forms]

34 questions
12
votes
5 answers

Rails: submit (via AJAX) when drop-down option clicked

What is the easiest and most graceful way to auto-submit an AJAX form when a drop-down box's option is selected? I'm creating an administration page where the admin can modify user permissions (where "permissions" is stored as an integer), and I…
Adam Rezich
  • 3,122
  • 6
  • 31
  • 39
4
votes
2 answers

Rails: Change form action from submit_tag

I have a form which is always submitting the form to the "update" function in the controller, and I have created this form using "remote_form_for" tag. In this form I have objects from different tables, and from this form I want to submit entire…
Sushanth CS
  • 2,412
  • 3
  • 23
  • 23
4
votes
5 answers

After submitting a remote form with Rails, how do I redirect the user to another page?

I’m using Rails 4.2.3. I want to submit a form in a modal dialog, so I have set up my form like so <%= form_for @my_object, :remote => true do |f| %> but if the user submits the form successfully, I would like to reload the page that invoked the…
Dave
  • 15,639
  • 133
  • 442
  • 830
4
votes
8 answers

How can we circumvent these remote forms drawback?

In an effort to have everything translateable in our website ( including the error messages for the validations ), we switched almost all of our forms to remote forms. While this helps with the ability to translate error messages, we have…
Geo
  • 93,257
  • 117
  • 344
  • 520
3
votes
1 answer

How to submit formtastic via ajax?

So i have a form generated by formtastic and it's working : <%semantic_form_for(Model.new,:url=>{:action=>"fooobar"}) do |f|%> <%end%> i was wondering if there's any way to submit this form via Ajax…
Mr_Nizzle
  • 6,644
  • 12
  • 55
  • 85
3
votes
2 answers

Rails turbolinks break submit remote form

I'm having a rather weird problem using Rails 4, Turbolinks and a remote form. I have a form looking like: <%= form_for [object], remote: true do |f| %> <%= f.text_field :name, class:…
Tom Naessens
  • 1,827
  • 22
  • 38
2
votes
2 answers

Submitting a rails remote_form with external submit button

I'm trying to submit a rails form using a submit trigger that is outside of the form tags. So I have my form: <% remote_form_for Package.new, :url => { :action => :rate_shop, :ids_sales_order_id => params[:ids_sales_order_id], :id => @shipment.id…
James M
  • 239
  • 1
  • 6
2
votes
2 answers

Rails 4 remote form issues bad request (ParamsParse::ParseError)

I have a problem with my remote form in rails 4 using simple form. It works perfectly when I use it without AJAX but as soon as I set remote to true rails throws an ActionDispatch::ParamsParser::ParseError saying unexpected token at…
irruputuncu
  • 1,460
  • 1
  • 11
  • 24
2
votes
1 answer

Rails 3 Ajax Form Not Sending Params

I have a form on my index page that I'm using to sort records, I wanted to add some Ajax functionality to it but for some reason it's not sending my form parameters as soon as I added Ajax to the mix. Here's my form:
<%=…
Noz
  • 6,216
  • 3
  • 47
  • 82
1
vote
0 answers

What is an alternative to nesting remote forms in rails?

I have a User that can have multiple images. I would like to allow the user to add images while updating their user page and have those images dynamically updated so that they can see the images on their profile as they edit it. I currently have the…
Oakland510
  • 1,073
  • 2
  • 12
  • 20
1
vote
1 answer

Remote: true on simple form not making AJAX request but rendering blank page instead

I know there are many posts about this issue, but most of them are really old and none includes ActionCable. So here comes the challenge: I am building a chat functionality with ActionCable and the messages are broadcasting successfully. The message…
1
vote
1 answer

Rails 5.2 - Removing the data-remote attribute doesn't submit the form as an HTML request

I am rendering a search form in Rails 5.2.2 and have logic that determines if the request should be an AJAX request or an HTML request. Here's what my form looks like:
Alexander
  • 3,959
  • 2
  • 31
  • 58
1
vote
0 answers

Error removing nested fields in remote form with cocoon

I have a simple_form with remote: true. I'm adding nested fields to it (people for this example) with cocoon. <%= simple_form_for @incorporation, html: {id:"incorporationform"}, remote: true, update: { success: "response", failure: "error"} do |f|…
neanderslob
  • 2,633
  • 6
  • 40
  • 82
1
vote
1 answer

How to use AJAX to toggle a boolean column in the database?

Currently trying to switch a poll's is_live attribute in the database through a button click in the view. Here's the form and click, which doesn't send the polls data in params. - current_user.polls.each do |poll| %tr#poll.id %td …
Keith Johnson
  • 730
  • 2
  • 9
  • 19
0
votes
1 answer

Redirect despite remote_form?

I have a remote form for updating one of my objects. However, after updating, Rails redirects to another page, essentially as if this form wasn't remote at all. What am I doing wrong? From the view:
Sprachprofi
  • 1,229
  • 12
  • 24
1
2 3