Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Radio Button validation fails when a selection is present #6342

Closed
aleksandarevangelatov opened this issue Mar 24, 2021 · 0 comments
Closed
Assignees
Milestone

Comments

@aleksandarevangelatov
Copy link
Contributor

Bug report

RadioButton for ASP.NET MVC validation fails when a selection is present. This is a regression introduced with v2021.1.119

Reproduction of the problem

Validation for a Radio Button defined the following way fails upon form submission

public class IndexViewModel
{
    public bool MyBoolProperty { get; set; } = false;
}
<form id="exampleForm">
	<div class="form-group">
		@(Html.Kendo().RadioButtonFor(m => m.MyBoolProperty).Label("Yes").Value(true))
		@(Html.Kendo().RadioButtonFor(m => m.MyBoolProperty).Label("No").Value(false))
	</div>
	<button type="submit" class="k-button">Submit</button>
</form>


<script>
	$(function () {
		const $form = $('#exampleForm');
		const validator = $form.kendoValidator().data('kendoValidator');
		$form.submit(function (e) {
			e.preventDefault();
			console.log(validator.validate());
		});
	});
</script>

Expected/desired behavior

Validation should pass if a selection is made

Workaround

Adding the k-radio-list class to the Radio Button container can be used as a workaround until the issue is resolved:

<div class="form-group k-radio-list">
    @(Html.Kendo().RadioButtonFor(m => m.MyBoolProperty).Label("Yes").Value(true))
    @(Html.Kendo().RadioButtonFor(m => m.MyBoolProperty).Label("No").Value(false))
</div>

Environment

  • Kendo UI version: 2021.1.224
  • Browser: [all]
@kendo-bot kendo-bot added the FP: Unplanned Sync status with associated Feedback Item label Mar 24, 2021
@kendo-bot kendo-bot added FP: Planned Sync status with associated Feedback Item FP: In Development Sync status with associated Feedback Item and removed FP: Unplanned Sync status with associated Feedback Item FP: Planned Sync status with associated Feedback Item labels Mar 24, 2021
@mparvanov mparvanov added this to the 2021.R1.SP.next milestone Mar 29, 2021
@kendo-bot kendo-bot added Next LIB FP: Completed Sync status with associated Feedback Item and removed FP: In Development Sync status with associated Feedback Item labels Mar 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants