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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:42:21+00:00 2026-05-23T12:42:21+00:00

I have a form with onsumbit attribute. I am calling a javascript function on

  • 0

I have a form with onsumbit attribute. I am calling a javascript function on the onsumbit.
I need to set some values on hidden variables before the form actually submits. That bit is done in the SaveQuery() function. I also have a link on the page which does the same action of submitting the form. I have added the onsubmit, so that the form gets submitted when some one presses the Enter key.

The problem is that when using jquery v1.4.4 library, the form seems to be submitted recursively. How do I avoid that from happening. With jquery v1.3.2, there doesn’t seem to be a problem.

The Form:

<form id="savequery" action="savedquery.aspx" method="post" onsubmit="SaveQuery(); return false;">
        <input type="hidden" id="orig_q" name="orig_q" value="" />
        <input type="hidden" id="isFullText" name="isFullText" value="" />
        <input id="queryName" name="queryName" value="New Query" />
        </form>
        <table class="centerButton">
            <tbody>
                <tr>
                    <td>
                        <div id="proceedSave" class="butActive idProceed">
                            <p>
                            </p>
                            <div>
                                <a href="#" onclick="SaveQuery();">Proceed</a></div>
                        </div>
                        <!-- duplicate text item -->
                    </td>
                </tr>
            </tbody>
        </table>

SaveQuery Function:

SaveQuery = function () {
    $("#orig_q").val(document.getElementById("txtQuery").value);
    $("#isFullText").val(document.getElementById("chkFulltext").checked);
    $("#savequery").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-23T12:42:21+00:00Added an answer on May 23, 2026 at 12:42 pm

    Instead of stopping the submission and triggering it, you can just let it pass though:

    onsubmit="SaveQuery();"
    
    var SaveQuery = function () {
      $("#orig_q").val(document.getElementById("txtQuery").value);
      $("#isFullText").val(document.getElementById("chkFulltext").checked);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form with an onsubmit attribute. I need to bind a new
I have some client-side JavaScript validation on a form. It works great. But I
I have form that displays several keywords (standard set of choice lists that changes
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 in which people will be entering dollar values. Possible inputs:
i have a input tag which is non editable, but some times i need
I have a form with many input fields on it, some with validation. I
I have form area in my view. If I click button A , I
I have a form in C# that has a button that, when clicked, I

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.