Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8511275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:56:40+00:00 2026-06-11T03:56:40+00:00

What is ‘the rails way’ to have a form with submit_tags for each row,

  • 0

What is ‘the rails way’ to have a form with submit_tags for each row, where the submit_tag ‘tells’ the controller which row’s submit was clicked?

Inside a form_tag, my form displays a list of users, and next to each user are several actions such as ‘foo’ and ‘bar’.

Currently I use link_to for those actions, which adds a query param :row => this_row.guid so my controller knows which row to take action on. It works, but I don’t like having the query params exposed on the url, and I don’t like how they persist on the URL so if the user clicks refresh it performs the action again.

Since the rows are displayed are inside a form already, I’d like to have each action be a submit_tag. But I do not see from the API docs that there is any way to add a different query param to each instance of a submit_tag.

When I try this:

= submit_tag "foo", {:row => this_row.guid}
= submit_tag "bar", {:row => this_row.guid}

The html DOES look like <input .... row='SOMEGUID' ...>

However the POSTed params do not include the :row query params

I also tried

= submit_tag "foo", params.merge(:row => this_row.guid)
= submit_tag "bar", params.merge(:row => this_row.guid)

with the same result ( includes the row=GUID, but that param is not POSted to the controller when the user clicks the submit button).

I’d appreciate any help on how to have many rows of submit buttons (with the same name visible to the user) also pass a row identfier to the controller.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T03:56:42+00:00Added an answer on June 11, 2026 at 3:56 am

    the value of the submit button also gets sent as a parameter. check your logs.

    UPDATE

    Add the row id as a data attribute of the submit button:

    = submit_tag "bar", {:data => {:row => this_row.guid}}
    

    Then when the submit button is clicked it should add the row id as a hidden field in the form before it gets submitted.

    $('input[type="submit"]').click(function(){
      $('form').append('<input type="hidden" name="row" value="' + $(this).data('row') + '" />');
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a text area in my form which accepts all possible characters from
I have just tried to save a simple *.rtf file with some websites and
I was writing code for dragging mechanism which invokes to wait for small period
I'm running a Octopress blog which is based on Jekyll . Now I wanted
I would like to run a str_replace or preg_replace which looks for certain words
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I don't have much knowledge about the IPv6 protocol, so sorry if the question
I have a reasonable size flat file database of text documents mostly saved in
I have the following tasks in my deploy.rb namespace :unicorn do desc stop unicorn
The problem with unsigned char. I am reading a PPM image file which has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.