function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Harivansh Pal BachchanHarivansh Pal Bachchan 

how to add selected multiple radio buttons key and value to an array

AnkaiahAnkaiah (Salesforce Developers) 
Hi Harivansh,

Refer the below link have solution for similar kind of ask.
https://stackoverflow.com/questions/57904985/add-selected-multiple-radio-buttons-value-and-uniqueid-to-an-array

Thanks!!
Rakesh kumar 708Rakesh kumar 708
To add the selected values of multiple radio buttons to an array, you will need to use JavaScript to iterate over the radio buttons, determine which ones are selected, and add their values to the array. Here is an example of how you could do this:

// Get a reference to the form containing the radio buttons
var form = document.getElementById("myForm");

// Create an empty array to store the selected values
var selectedValues = [];

// Iterate over the form elements
for (var i = 0; i < form.elements.length; i++) {
  // Get the current element
  var element = form.elements[i];

  // Check if the element is a radio button and if it is selected
  if (element.type === "radio" && element.checked) {
    // Add the value of the selected radio button to the array
    selectedValues.push(element.value);
  }
}

// The selectedValues array now contains the values of the selected radio buttons

This code will loop through all the elements in the form, and add the value of any selected radio buttons to the selectedValues array. You can modify this code to suit your specific needs and requirements.
I hope this helps! Let me know if you have any other questions.
 

Some useful Greetings and Quotes for Everyone 🤗

 

💛Good Morning Image in Hindi 

💛Happy new year 2023 images and Greetings

🥰 Romantic Good Night Images

😍 Good Night Images

🌆 Good Evening Images

🌼 Good Afternoon Images

🌷 Good Morning Images

🎄 Free Jesus Christmas Images

🔴Not to-do list for Students

🔴DO NOT LIST—On Finance and Investment

🔴DO NOT LIST—From the Book of Bible

🔴NOT TO DO LIST—Journals!

🔴NOT TO DO LIST—Christmas Special

🔴Bible Quotes in Malayalam

🔴Bible quotes in Telugu

💚4 Advantages of Sending Good-Night Images and Images

💚2 Secret Greeting images to impress friends, family, and lover

💚Why we must send good morning images to friends and loved ones!