Search results

Name and Value in form submit

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.

tagHelper
form.cs
<form>
    <ul>
        <li>
            <ejs-radiobutton id="radio1" value="credit" label="Credit/Debit Card" name="payment" checked="true"></ejs-radiobutton>
        </li>
        <li>
            <ejs-radiobutton id="radio2" value="netbanking"  label="Net Banking" name="payment"></ejs-radiobutton>
        </li>
        <li>
            <ejs-radiobutton id="radio3" value="cash"  label="Cash on Delivery" name="payment"></ejs-radiobutton>
        </li>
        <li>
            <ejs-radiobutton id="radio4" value="others"  label="Others" name="payment"></ejs-radiobutton>
        </li>
        <li>
            <ejs-button id="primarybtn" content="Submit" isPrimary="true"></ejs-button>
        </li>
    </ul>
</form>
<style>
    .e-radio-wrapper {
        margin-top: 18px;
    }

    button {
        margin: 20px 0 0 5px;
    }

    li {
        list-style: none;
    }
</style>
public ActionResult Form()
{
    return View();
}