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 6194617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:19:36+00:00 2026-05-24T03:19:36+00:00

I have two forms: = form_for @form_one, :url => form_path do |f| = f.hidden_field

  • 0

I have two forms:

= form_for @form_one, :url => form_path do |f|
  = f.hidden_field :promotion_id
  = f.label :page_title, 'After Like: Page Title'
    = f.submit 'Update', :class => 'smBlueButton'

= render :partial => 'form_two'

How Do I move the Submit tag from form 1 below form 2, where form 2’s submit tag is displayed before form one?

This does not work:

   = form_for @form_one, :url => form_path do |f|
      = f.hidden_field :promotion_id
      = f.label :page_title, 'After Like: Page Title'
    = render :partial => 'form_two'
      = f.submit 'Update', :class => 'smBlueButton'
  • 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-05-24T03:19:37+00:00Added an answer on May 24, 2026 at 3:19 am

    It’s fine to have 2 submit tags but you can only have one form.
    The submit tags will both post back to the forms controller action as defined in the form_for declaration. All you need to do in the controller action is check the commit param (params[:commit]) for the value of the button text and act accordingly in a condition based on that value.

    So remove the form_for from partial 2 (Perhaps a fields_for could be used here instead), move the submit button to form1 wherever you want it and check the commit params hash for the appropriate value

    e.g.

    def update
      if params[:commit] == 'Update form 1'
        #do something
      elsif params[:commit] == 'Update form 2'
        #do something else
      else
        #Rails an error - You have not set the right values in your form submit buttons
      end
    end
    

    Better to use i18n for the button text and the controller logic to test for the button text then you are free to change the button text to whatever you want without messing up you checks in your controller

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

here is what my code looks like i have two forms: class Form_1 extends
I have two forms on a single page. Actually they're seperated pages but the
I have two functions, one that creates a table like so: function return_formatted_results(result_no,addy,title,own_comment) {
I have two forms, form A and form B. These forms must differ in
I have two forms. The first form is the mainForm, this never goes anywhere.
I have created two forms in my Windows Application. One Form acts as a
I have two links with classes (login-form and register-form) relevant to their target forms
I have two forms in one view updating the User Profile. One Form is
Here I have a two files. One for forms and second php for getting
I have a URL of form http://www.example.com?foo=one&foo=two I want to get an array of

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.