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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:46:43+00:00 2026-05-24T21:46:43+00:00

I am trying to pass multiple values for a single field name to an

  • 0

I am trying to pass multiple values for a single field name to an ajax call:

<form>    
  <input type="hidden" name="fieldName" value="MyValue1">
  <input type="hidden" name="fieldName" value="MyValue2">
  <input type="hidden" name="fieldName" value="More data...">
  <input type="hidden" name="fieldName" value="More data...">
  <input type="hidden" name="fieldName" value="More data...">
  <input type="hidden" name="fieldName" value="More data...">
</form>

I cannot simply submit the form because the submission has to be done using ajax for reasons that are not relevant to this situation.

When I serialize this form data, I get the following:

formData: Object
  fieldName: Array[6]
    0: "MyValue1"
    1: "MyValue2"
    2: "More data..."
    3: "More data..."
    4: "More data..."
    5: "More data..."
    length: 6

So far, this looks good to me. Here is where I submit this to the server:

$.post("/MyHandler.axd", formData, function (data) {
       // etc.
});

On the server, code which I do not control does the following:

string[] values = request.Form.GetValues("fieldName");

At this point, values is null. However, if I do this:

string[] values = request.Form.GetValues("fieldName[]");

values has my array of length 6, with the correct data in it, etc.

I understand what is happening here, but I don’t know why or how I can get around it. Is there a way for me to pull out fieldName instead of fieldName[] without submitting the form?

Thanks.

EDIT: After trying @raymondralibi’s suggestions, I am now getting the following:

For the first suggestion (getSerializeArray($(this).closest('form'))), I get this:

formData: Object
  : undefined
  __proto__: Object

And for the second (getSerializeArray2($(this).closest('form'))), I get this:

formData: Array[1]
  0: Object
    : undefined
    __proto__: Object
  length: 1
  __proto__: Array[0]

Perhaps I am calling these incorrectly; any thoughts? Thanks again.

  • 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-24T21:46:43+00:00Added an answer on May 24, 2026 at 9:46 pm

    Well, I ended up getting this working, but I don’t like how I did it:

    Before the code that executes that calls request.Form.GetValues("fieldName"), I do the following:

        var entriesTable = typeof(System.Collections.Specialized.NameObjectCollectionBase).GetField("_entriesTable", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(HttpContext.Current.Request.Form) as System.Collections.Hashtable;
        entriesTable.Add("fieldName", entriesTable["fieldName[]"]);
    

    This copies the ArrayList to the correct key in the hash table, and everything works fine. Still, I would prefer to have this passed correctly from the client side, but for now this works.

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

Sidebar

Related Questions

I am trying to pass a dataString to to an ajax call using JQuery.
I'm trying to pass multiple values from PHP into my javascript function. The function
I'm trying to pass multiple checkboxes with different values to a PHP script that
How to pass multiple values with $.post ? I'm tryed like this $.post(page.php, {field:
I am trying to pass multiple instances of an element to a web servile
im trying to pass two parameters to a function, i being an int value
I'm trying to pass a null value for the first parameter in the code
I'm trying to display multiple, static jQuery Progress Bars on a single page, all
My terminology is probably way off here but basically I'm trying to pass multiple
I am trying to pass an array of values into an array of a

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.