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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:16:34+00:00 2026-06-12T21:16:34+00:00

I have a form with a miltiple select element along with other input and

  • 0

I have a form with a miltiple select element along with other input and select elements. I have access to the post data object before submiting to the server and I want to modify the post data before allowing it to reach the server.

If no options are selected in my multiple select called equipments the value is “null” here is what the post data looks like.

({roomNumber:"As369", minCapacity:"1", maxCapacity:"10", capacity:"8", campus:"1", equipments:null, roomGrid_id:"127"})

If equipments is null, I want to change the key from “equipments” to “equipments[]” and the value from “null” to and empty array. You see my actuon expects “equipments[]”. Ideally, if there is atleast one selected item in the multiple select here is what the postdata will look like.

({roomNumber:"As369", minCapacity:"1", maxCapacity:"10", capacity:"8", campus:"1", equipments:["2"], roomGrid_id:"127"})

Any Ideas ?
I was thinking about simply adding a new key:value pair called equipments:[]

  • 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-12T21:16:35+00:00Added an answer on June 12, 2026 at 9:16 pm
    var obj = {
        roomNumber:"As369",
        minCapacity:"1", 
        maxCapacity:"10", 
        capacity:"8", 
        campus:"1", 
        equipments:null, 
        roomGrid_id:"127"
    } 
    
     if(obj["equipments"] === null ) {
          delete obj["equipments"];
          obj["equipments[]"] = [] 
       }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got this HTML form where I have multiple input elements: text, radio, and
var d = $('form[name=aspnetForm]').formSerialize(); $.ajax({ type: POST, data: d }); I have a ListBox
i have a form that has select element <select name=adddisplaypage[] id=adddisplaypage multiple=multiple> <option value=all
I have a form with a table that has two input boxes, a select
if i have a form with the following two elements. <select name= size=5 id=reasons
I have mock-up of a form, in which there's a file input element that
i have a form that has a multiple select drop down. a user can
I have form with multiple input type=radio with text next to them. I want
I have an HTML form that needs multiple submit buttons, like this: <input type=submit
I have a form in which a user can select multiple options in 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.