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

  • Home
  • SEARCH
  • 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 3234440
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:23:30+00:00 2026-05-17T17:23:30+00:00

I have a form where I’m using Jquery to submit the form to create

  • 0

I have a form where I’m using Jquery to submit the form to create a preview output on the right-hand side of my screen (I have some complex inputs and want to use ruby to process them to create the preview).

After the user has completed the form and presses the submit button, I want the form to submit normally (i.e., as if Jquery is not being used). Is there any way of doing this?

I feel like the answer to this is probably really simple and I’m just completely missing something.

Here’s how I’m submitting a select button (for validation)

$('#body_message select').change(function() {
        $('form').submit();
      });

Here’s my current code for handling the submit button. When the user clicks the submit button, I change the value of a hidden field with id “message_submit_button” so this submit will be handled differently from the validation submits.

$('#body_message input[type="submit"]').click(function() {
        $('#body_message #message_submit_button').val("1");
        $('form').submit(function(){
            $.ajax({
              type: 'POST',
              url: $(this).attr('action'),
              data: $(this).serialize(),
              success: XMLHttpRequest.getResponseHeader("Location"),
              dataType: "html"
            });
            return false;   
        });

  });

EDITED:
Using the first part of the answer, I’ve changed the Jquery on my submit button to the following, and it works as desired:

$('#body_message input[type="submit"]').click(function() {
      $('#message_submit_button').val("1");
      $('form')[0].submit();    
});
  • 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-17T17:23:31+00:00Added an answer on May 17, 2026 at 5:23 pm

    You can bypass the jQuery .submit() handler by calling the native form.submit() function, like this:

    $('form')[0].submit();
    

    I would change it like this:

    $('#body_message input[type="submit"]').click(function() {
      $('#message_submit_button').val("1");
      var form = $(this).closest("form")
      $.ajax({
        type: 'POST',
        url: form.attr('action'),
        data: form.serialize(),
        success: XMLHttpRequest.getResponseHeader("Location"),
        dataType: "html"
      });
      return false;   
    });
    

    Then in your other buttons when submitting…just do nothing and it’ll submit normally, that way this handler handles only this submit button, not the other that should do a normal submission.

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

Sidebar

Related Questions

I have subclassed Form to include some extra functionality, which boils down to a
I have a form with some radio buttons that are disabled by default. When
I have a form with many input fields. When I catch the submit form
I have form which is opened using ShowDialog Method. In this form i have
I have form area in my view. If I click button A , I
I have form that displays several keywords (standard set of choice lists that changes
I have a form in C# that has a button that, when clicked, I
I have a form like this: <form name=mine> <input type=text name=one> <input type=text name=two>
I have a form in which people will be entering dollar values. Possible inputs:
I have a form element that contains multiple lines of inputs. Think of each

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.