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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:07:08+00:00 2026-05-29T04:07:08+00:00

Lets say I have a form: <form id=form1 method=post> <ul> <li class=button> Button 1!

  • 0

Lets say I have a form:

<form id="form1" method="post">
    <ul>
        <li class="button">
            Button 1!
            <input name="some_input" type="hidden" value="Number 1" />
        </li>
        <li class="button">
            Button 2!
            <input name="some_input" type="hidden" value="Number 2" />
        </li>
    </ul>
</form>

and my javascript is:

<script type="text/javascript">
    $('document').ready(function () {
        $('li.button').bind("click", function() {
             $('form1').submit();
        });
    });
</script>

Note: When I click on the li element Button!, it triggers the form to submit.

Now when I click (e.g. Button 1!) the form gets sent, it gets sent successfully, and it is processed without any problems. However problem arise when I hit the “Back” button on the browser and click on a different link (e.g. Button 2!). It seems to me as if the browser is submitting the same value as before, even though the input values for the both of them are different.

How do I solve this?

  • 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-29T04:07:09+00:00Added an answer on May 29, 2026 at 4:07 am

    You are submitting the same form. It doesn’t matter what button you click. You have both buttons bound to a click event which triggers a single form to submit which contains two values.

    Also, your ids are set not your class so it should be $('li#button').... You change your html to class though for proper semantics.

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

Sidebar

Related Questions

Lets say I have a really simple html form: <form action=./whatever.php method=POST> <input type=submit
Let's say I have this form: <form action=submit method=post> <select name=category id=categorylist> <option value=love>Love</option>
lets'say i have a form, with like this : <form name=frmMail method=POST action=save.do dojoType=dijit.form.Form
Let's say we have this code: <form action='' method='POST' enctype='multipart/form-data'> <input type='file' name='userFile'><br> <input
Lets say i have a html file that contain a form: <form method=post action=url>
For simplicity lets say I have two flex mxml pages. form.mxml button.mxml If the
I currently have a form with lets say 5 radio button entries (see below).
Let's say I have form in javascript file: function form(csrf){ document.write('<form action= method=post>'+csrf); document.write(....);
Let's say i have a form <form action=delete_post.php method=post>...</form> on my website: http://mysite.com and
Lets say i have a form which have the following : Name:TextBox Email:TextBox Age:TextBox

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.