New to Kendo UI for jQuery? Start a free 30-day trial
Required Switch
Updated on Nov 2, 2026
The Switch is created from an input element of type checkbox. To require the user to turn the Switch on before a form is submitted, use the Kendo UI Validator with the required attribute of the input element.
To make the Switch mandatory:
- Add the
requiredattribute and anameattribute to theinputelement. - Optionally, set the message that the Validator displays through the
validationMessageattribute. - Initialize the Switch.
- Initialize the Validator on the
formelement.
When the Switch is off, the Validator displays the validation message and prevents the form from being submitted. When the Switch is on, the form is submitted.
The following example demonstrates how to require the Switch to be turned on.
html
<form id="form">
<input type="checkbox" id="accept" name="Accept" required validationMessage="Acceptance is required" />
<label for="accept">Accept the terms</label>
<button type="submit" class="k-button">Submit</button>
</form>
<p id="result"></p>
<script>
$("#accept").kendoSwitch();
$("#form").kendoValidator();
$("#form").on("submit", function(e) {
e.preventDefault();
$("#result").text("The form is valid.");
});
</script>