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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:42:43+00:00 2026-06-05T06:42:43+00:00

The two simple forms I have looks like this: = simple_form_for(@class_room, :html=>{:id=>’class_room_form’}) do |class_room_form|

  • 0

The two simple forms I have looks like this:

= simple_form_for(@class_room, :html=>{:id=>'class_room_form'}) do |class_room_form|

and

= simple_form_for(@lesson, :html => {:id=>'lesson_form'}) do |lesson_form|

now, although I am submitting form of id lesson_form, form with id class_room_form is submitted instead! any idea what to do ?

here is how I submit the lesson_form form:

:javascript
  $('#submit_lesson_button').bind('click', function() {
    $("#lesson_form").trigger('submit');
    });

here is how I submit the other form ( the one that is still submitted regardlessly )

:javascript
  $('#submit_button').bind('click', function() {
    $('#sidenav a:first').tab('show');
    $('#class_room_form').trigger('submit');
    });

you see, each form with different ids, and I am targeting those different ids with jQuery, so what could be wrong ??

notice that form lesson_form is contained within form class_room_form

  • 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-05T06:42:45+00:00Added an answer on June 5, 2026 at 6:42 am

    You’re not supposed to have a form contained is another form. If you can change this, it will certainly solve your problem, and your code will be cleaner.

    If you can’t, try to add event.preventDefault() to your functions, like this :

    :javascript
      $('#submit_lesson_button').bind('click', function(event) {
        event.preventDefault();
        $("#lesson_form").trigger('submit');
      });
    
    :javascript
      $('#submit_button').bind('click', function() {
        event.preventDefault();
        $('#sidenav a:first').tab('show');
        $('#class_room_form').trigger('submit');
      });
    

    I suppose #submit_lesson_button and #submit_button are <input type="submit" ... >

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

Sidebar

Related Questions

I have simple form like this which accepts only two values string action and
I have two classes which look like this in barebones form: @interface GraphNode {
I have a simple form with two fields and an optional field which is
I have a simple form and inside there are two input fields text type.
I have a simple in VB/ASP.NET form containing two text boxes, I am attempting
I have two simple margin styles defined, one based off the other. <Style x:Key=marginStyle
I have two simple NSMutableArray that consists of few objects. Some of these objects
I have two simple textareas where in i want to highlight the javascript code
I have two simple programs that use named pipes, here is the first: int
I have a fairly simple database that I inherited. For the purposes of this

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.