This is a migrated thread and some comments may be shown as answers.

Notification in a pop up template grid

2 Answers 134 Views
Notification
This is a migrated thread and some comments may be shown as answers.
Sean
Top achievements
Rank 1
Sean asked on 19 May 2017, 10:34 AM

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 Answers, 1 is accepted

Sort by
0
Sean
Top achievements
Rank 1
answered on 19 May 2017, 10:39 AM
Sorry, file here
0
Sean
Top achievements
Rank 1
answered on 19 May 2017, 02:13 PM
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>
Tags
Notification
Asked by
Sean
Top achievements
Rank 1
Answers by
Sean
Top achievements
Rank 1
Share this question
or