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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:33:44+00:00 2026-06-05T06:33:44+00:00

Hi I have the below example form <form id=search method=GET action=/results> <input type=text name=name>

  • 0

Hi I have the below example form

<form id="search" method="GET" action="/results">
    <input type="text" name="name">
    <input type="checkbox" name="rating" value="1">
    <input type="checkbox" name="rating" value="2">
    <input type="checkbox" name="rating" value="3">
    <input type="checkbox" name="rating" value="4">
    <input type="checkbox" name="rating" value="5">
    <input type="submit" value="Submit" name="submit">
</form>

When I submit the form after selecting some of the rating checkboxes and use JQuery serialize() as shown below

$('#search').submit(function() {
    var $form = $(this);
    var strFormData = $form.serialize();
    //var objFormData = $form.serializeArray();
    //var strFormDataParamResult = $.param(objFormData);
});

I get an example for strFormData like this

"name=help&rating=1&rating=2&rating=3"

Is there a way to combine any params with the same name into this result

"name=help&rating=1,2,3" 

by manipulating the result of serializeArray() and then using $.param(..) ?

If so does anyone have an example of this?

Thanks for any help.

  • 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-05T06:33:46+00:00Added an answer on June 5, 2026 at 6:33 am

    This was my solution in the end.. serializeArray and manipulating the object that way seemed a bit complicated, the below isn’t much better but it does what I want.

        // Combine key=value pairs in escaped serialised form data that have the same key
        // example: "&rating=5&rating=4&rating=3" becomes "&rating=5,4,3"
        function combineSerialisedFormData(strEscapedSerialisedFormData) {
            var arrFormData = strEscapedSerialisedFormData.split("&");
            var dictCombinedKeys = {};
            for (var i = 0; i < arrFormData.length; i++) {
                var arrParam = arrFormData[i].split("=");
                var strKey = arrParam[0];
                var strValue = arrParam[1];
    
                             if (strKey !== "" && strValue !== "") {
                if (typeof (dictCombinedKeys[strKey]) === "undefined") {
                    dictCombinedKeys[strKey] = strValue;
                }
                else {
                    dictCombinedKeys[strKey] += "," + strValue;
                }
                            }
            }
    
            // { name : "help" , rating : "5,4,3,2,1,0", test : "" }
            // change this object into an array of key value pairs like this
            // ["name=help","rating=5,4,3,2,1,0","test="]
            var arrKeyValuePairs = [];
            for (var key in dictCombinedKeys) {
                if (dictCombinedKeys.hasOwnProperty(key)) {
                    arrKeyValuePairs.push(key + "=" + dictCombinedKeys[key]);
                }
            }
    
            return arrKeyValuePairs.join("&");
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a table t_points in mySql like example in below. Name Surname Point
okay, so i have a text file with example content below line1with some random
I have a page with more than one form. One form (see below example)
I have got below code to GET dictionary type of session variable value. Please
I have a button example below <button id=startrunning>go</button> There is no form or anything
Let's consider the below example. There, I have: target MAIN calls target t and
I have posted an example below and the desired result . I saw a
I have a model defined as below: class Example(models.Model): user = models.ForeignKey(User, null=True) other
I have a basic PHP question, take the code below for example, let's say
Tech used: PHP 5.3.10 Hi, I have an array (example below) I need to

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.