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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:48:18+00:00 2026-06-17T21:48:18+00:00

I am having an issue where I am trying to pass a submit buttons

  • 0

I am having an issue where I am trying to pass a submit buttons values along with the form to ajax but for some reason the only value that passes no matter which button I push is the first button. There is more to the form but I am just showing the buttons.

<form>
    <input type="submit" name"finalize_invoice" id="finalize_invoice" value="Delete" />
    <input type="submit" name"finalize_invoice" id="finalize_invoice" value="Save" />
    <input type="submit" name"finalize_invoice" id="finalize_invoice" value="Finalize" />
</form> 
      $(document).ready(function(){
            $("form#submit").submit(function() {
            // we want to store the values from the form input box, then send via ajax below
            var invoice_temp_id = $('#invoice_temp_id').attr('value');
            var man_part_number = $('#man_part_number').attr('value');
            var customer = $('#customer').attr('value');
            var date = $('#date').attr('value');
            var shipdate = $('#shipdate').attr('value');
            var shipvia = $('#shipvia').attr('value');
            var ponumber = $('#ponumber').attr('value');
            var rep = $('#rep').attr('value');
            var invoicenotes = $('#invoicenotes').attr('value');
            var serial_number = $('#serial_number').attr('value');
            var skid = $('#skid').attr('value');
            var finalize_invoice = $('#finalize_invoice').attr('value');
            $.ajax({
            type: "POST",
            url: "includes/createfinalinvoice.php?",
            data: "invoice_temp_id="+ invoice_temp_id+
                "&man_part_number="+ man_part_number+
                "&customer="+ customer+
                "&date="+ date+
                "&shipdate="+ shipdate+
                "&shipvia="+ shipvia+
                "&ponumber="+ ponumber+
                "&rep="+ rep+
                "&invoicenotes="+ invoicenotes+
                "&serial_number="+ serial_number+
                "&skid="+ skid+
                "&finalize_invoice="+ finalize_invoice+
                $( this ).serialize(),
                success: function(data){
                    if (data == 1) {
                        var thiserror = 'You may not have any blank fields, please make sure there is a serial number in each field';
                        alert(thiserror);
                    }
                    if (data == 2) {
                        var thiserror = 'Your serial number(s) do not match with the Manufacture Part Numbers, please double check your list';
                        alert(thiserror);
                    }
                    if (data == 3) {
                        var thiserror = 'Some of your serial numbers are not located in the database, please make sure you entered the correct serial number';
                        alert(thiserror);
                    }
                    if (data == 4) {
                        var thiserror = 'This item has already been sold to another customer. Please report this to administration';
                        alert(thiserror);
                    }
                    if (data == 5) {
                        var thiserror = 'Everything went OK, you may continue and view the processed invoice';
                        alert(thiserror);
                    }
                    if (data == 6) {
                        var thiserror = 'There are no default prices setup for this customer matching the Manufacture Part Numbers. Please check and make sure they all exist before processing this list';
                        alert(thiserror);
                    }
                    if (data == 7) {
                        window.location = ('/admin/?mmcustomers=1&viewinvoice=1');
                    }

                }
            });
            return false;
            });
         });
  • 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-17T21:48:19+00:00Added an answer on June 17, 2026 at 9:48 pm

    You have three submit buttons with identical ids of finalize_invoice. ids must be unique however. This is the reason, jquery selects the first button only, no matter which one was clicked. If you want to send the request with the clicked button, bind a function to the button‘s click event

    $('form#submit input[type="submit"]').click(function() {
        ...
        var finalize_invoice = $(this).attr('value');
        $.ajax(...);
        ...
        return false;
    }
    

    As @thaJeztah suggested, suppressing the submit event on form

    $('form#submit').submit(function() {
        return false;
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to pass an id to a hidden form element and having some
I'm having an issue with the code below, for some reason I get the
I'm having a issue trying to pass the data from my SQLite DB to
I am having an odd issue. I am trying to pass the information people
I am having an issue trying to make a small text-fantasy type game involving
I am having an issue trying to deal with timezones in the JQuery date/time
I am having an issue with trying to retrieve the contents of the view
I'm having an issue when trying to do something which should be as easy
I am having a big issue trying to delete from an UITableView. Just for
I'm having this issue when trying to use an ASPX page from a referenced

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.