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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:27:25+00:00 2026-06-13T00:27:25+00:00

How to get all form value and serialize multiple select with a given variable

  • 0

How to get all form value and serialize multiple select with a given variable or an array?
output parameter must be;

id=1&name_1=John&name_2=Juan&name_3=Isabel&name_4=Doe

where the name is in multiple select

  • 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-13T00:27:26+00:00Added an answer on June 13, 2026 at 12:27 am

    As this answer demonstrates, jQuery will use the same ‘name’ value as the key for each selection when serializing via $(form).serialize():

    id=1&name=John&name=Juan&name=Isabel&name=Doe
    

    and it’s up the server to understand how to handle it. Chances are that your server will handle it just fine.

    If you absolutely require the format you mentioned, you should be able to hack it together using something like this (untested):

    var elementArray = $(form).serializeArray();
    var modifiedArray = [];
    var counts = {};
    var multipleValues = {};
    $.each(elementArray, function(index, value) {
      if (counts[value.name]){ counts[value.name] += 1; } else { counts[value.name] = 1; }
    });
    $.each(elementArray, function(index, value) {
      if (multipleValues[value.name] || counts[value.name] > 1){ 
        if (!multipleValues[value.name]) { multipleValues[value.name] = 0; } else { multipleValues[value.name] += 1; }
        modifiedArray.push({name: value.name + "_" + multipleValues[value.name], value: value.value});
      } else {
        modifiedArray.push({name: value.name, value: value.value});
      }
    });
    var result = $.param(modifiedArray);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get all the input elements from a certain form from jQuery
I'm trying to duplicate a particular entry in the form. I get all the
What I am trying is to catch all the form submit events, get the
Can get all triples with value null in specific field? All people with date_of_birth
Is it possible to get all 7 days for a given date using linq
I'm using jQuery.serialize to retrieve all data fields in a form. My problem is
When I post a form using dojo.xhrPost , I get all the fields in
To get all contacts I'm using ABAddressBookCopyArrayOfAllPeople method but, this method return all contacts
I am trying to get all Books from the server (local PHP script), that
I'm trying to get all downloads from an repo on github with help of

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.