Can not get required checkbox working (Terms and Condition Checkbox)

2 posts, 0 answers
  1. Peng
    Peng avatar
    13 posts
    Member since:
    Aug 2010

    Posted 28 Nov 2016 Link to this post

    Hi there,

    So I was working on a solution for required checkbox, Terms and Conditions. 

    You know, where you must check it so you can submit a form. 

    So I was using all the Telerik components (Data Access ORM, ASP.NET MVC UI) and build the form like so. 

    And I really want to get the checkbox must be checked. I tried following this tutorial below:

    http://jasonwatmore.com/post/2013/10/16/aspnet-mvc-required-checkbox-with-data-annotations

    And I have tried all the methods there, it does not work. The form would still be able to submit without checkbox being checked.

    I am thinking if there is something special about Telerik that I can't get it working?

    Help would be really appreciated! Thank you.

     

     

    Kendo.MVC version is 2016.2.607.440. 

    .Net 4.5

    If you need more information please let me know.

  2. Ianko
    Admin
    Ianko avatar
    1660 posts

    Posted 30 Nov 2016 Link to this post

    Hello Peng,

    Based on the example from the .NET Fiddle I am unable to define what the difficulty might be. The Kendo().CheckBoxFor() helper works as expected and validation errors are shown when the checkbox is not checked. 

    On a side note you can also consider using client-side validation as addition to the server-side one: http://demos.telerik.com/aspnet-mvc/validator/index

    You can find attached a small project that shows the checkbox validation with both suggestions implemented.

    Regards,
    Ianko
    Telerik by Progress
    Telerik UI for ASP.NET MVC is ready for Visual Studio 2017 RC! Learn more.
Back to Top