NumericTextBox disappears from invalid form on post

2 posts, 0 answers
  1. C.P.A.M. Van Aaken
    C.P.A.M. Van Aaken avatar
    3 posts
    Member since:
    Jan 2007

    Posted 16 Oct 2014 Link to this post

    Since the problem is quite complex, I have included a sample project in attachment to reproduce the problem. I had to leave out the downloaded NuGet packages, Content/kendo and Scripts/kendo to get the zip under 2 Mb. I thrust you can get it working again. If not, it is basically an MVC5 project with KendoUI added, a model, and some changes to the HomeController and its _Layout and Index views.

    Due to the combination of Kendo UI NumericTextBox, jquery validation, server-side model validation, the numeric text box disapears.

    Steps to reproduce with solution in attachment:
    - Run the project ;-)
    - Click Post
    - Empty the non-Telerik textbox
    - Click Post again
    - Watch the NumericTextBox disappear.

    My analysis so far:
    - In the first postback, client-side validation doesn't find an error, but server side validation does (the NumericTextBox is required)
    - Then, with the second postback, client-side validation does find an error with the non-Telerik textbox, but not with the NumericTextBox
    - jQuery validation empties all spans with the class "input-validation-error", where it can no longer find a validation error
    - the initialised NumericTextBox fits this description, so the span is emptied, making the NumericTextBox disappear.

    My questions:
    - Why doesn't the "Required" error get caught on client-side validation?
    - How do we keep the described side effect from happening for cases where we verify certain business rules on server-side only?
  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 17 Oct 2014 Link to this post

    Hi,

    I believe that the problem and its solution is described here. Let me know if I am missing something in current scenario.

    As to the concrete question:
    - Why doesn't the "Required" error get caught on client-side validation?

    By default, jQuery validate (since v1.9) does not validate hidden elements. Refer to the shared article for more information.

    - How do we keep the described side effect from happening for cases where we verify certain business rules on server-side only?

    The troubleshooting section should give a feasible solution to this issue.

    Regards,
    Georgi Krustev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
Back to Top