Search results

Name and Value in form submit in JavaScript Radio Button control

06 Jun 2023 / 1 minute to read

The name attribute of the RadioButton is used to group RadioButton. When the RadioButton are grouped in form, the checked items value attribute will be post to server on form submit that can be retrieved through the name. The disabled RadioButton value will not be sent to the server on form submit.

In the following code snippet, Credit and Debit card is in checked state. Now, the value that is in checked state will be sent on form submit.

Copied to clipboard
import { Button, RadioButton } from '@syncfusion/ej2-buttons';
import { enableRipple } from '@syncfusion/ej2-base';


//Name and Value attribute in form submit.
let radiobutton: RadioButton = new RadioButton({label: 'Credit/Debit Card', name: 'payment', value: 'credit/debit', checked: true});

radiobutton = new RadioButton({label: 'Net Banking', name: 'payment', value: 'netbanking'});

radiobutton = new RadioButton({label: 'Cash on Delivery', name: 'payment', value: 'cashondelivery'});

radiobutton = new RadioButton({label: 'Others', name: 'payment', value: 'others'});

let button: Button = new Button({ isPrimary: true });
Copied to clipboard
<!DOCTYPE html>
<html lang="en">

    <title>EJ2 RadioButton</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="Typescript UI Controls" />
    <meta name="author" content="Syncfusion" />
    <link href="//" rel="stylesheet" />
    <link href="//" rel="stylesheet" />
    <link href="styles.css" rel="stylesheet" />
    <script src=""></script>
    <script src="systemjs.config.js"></script>

    <div id='loader'>LOADING....</div>
    <div id='container'>
                <li><input type="radio" id="radiobutton1" /></li>
                <li><input type="radio" id="radiobutton2" /></li>
                <li><input type="radio" id="radiobutton3" /></li>
                <li><input type="radio" id="radiobutton4" /></li>
                <li><button id="btnElement">Submit</button></li>

Copied to clipboard
#container {
    visibility: hidden;

#loader {
  color: #008cff;
  height: 40px;
  width: 30%;
  position: absolute;
  top: 45%;
  left: 45%;

.e-radio-wrapper {
  margin-top: 18px;

button {
  margin: 20px 0 0 5px;

li {
  list-style: none;