Notification in a pop up template grid

3 posts, 0 answers
  1. Sean
    Sean avatar
    3 posts
    Member since:
    Jun 2014

    Posted 19 May Link to this post

    Hello,

     

    I have implemented the upload success and error template from this demo http://demos.telerik.com/aspnet-mvc/notification/templates.

    I am trying to display the error template if one of three fields in the pop up template are not valid otherwise the success one.

    I think it is a problem about the k-invalid class being applied to a different DOM element but I am not sure.

    This boolean var invalid = (startDateField.hasClass("k-invalid") || endDateField.hasClass("k-invalid") || entitlementField.hasClass("k-invalid")) is still false even one or more of the fields have the class k-invalid

    I have put in attachments the files required.

    Thanks you

     

  2. Sean
    Sean avatar
    3 posts
    Member since:
    Jun 2014

    Posted 19 May in reply to Sean Link to this post

    Sorry, file here
  3. Sean
    Sean avatar
    3 posts
    Member since:
    Jun 2014

    Posted 19 May Link to this post

    I resolved the issue, I post the code below if it can help someone
     
    <script>
        $(document).ready(function () {
            $(".k-grid-update").attr("id", "showNotification");
     
            $("#showNotification").on("click", function () {
                var notification = $("#notification").data("kendoNotification");
                var invalid = ($("#StartDate").hasClass("k-invalid") || $("#EndDate").hasClass("k-invalid") || $("#Entitlement").hasClass("k-invalid"));
                 
                if (invalid) {/*if one or more of the 3 fields are invalid*/
                    notification.show({
                        title: "Email not sent",
                        message: "Please try again."
                    }, "error");
                }
                else {/*fields valid*/
                    notification.show({
                        message: "Email sent"
                    }, "upload-success");
                }
            });
        });
    </script>
Back to Top