Custom Validation Function in Inline Edit during Save / Edit

Aug 5, 2014 at 11:35 AM
Need to have a custom validation function for validating the two date fields (valid from and valid to) during inline add/edit and make a field non editable if the specific condition is true. Our code for the validation required is as below
(           
            if ($("#_empty_ValidFrom").val() != 0) {
                var e = new Date($("#_empty_ValidFrom").val());
                var d = new Date();
                if (e < d) {
                    $("#_empty_ValidFrom").attr("readonly", true);
                }
            }
)and
if ($("#_empty_ValidFrom").val() > $("#_empty_ValidTo").val()) {
.......
}

The options provided are as follows
           beforeSaveCell:
    //     The function for event which is raised before validation of values if any.
    //
           beforeSubmitCell:
    //     The function for event which is raised before submit the cell content to
    //     the server. in JqGridHelper Class
Need support / guidance to implement this validation as we are not able to know where and how exactly need to be applied. Kindly give us the suggestion with the examples.
Coordinator
Aug 5, 2014 at 5:58 PM
This question is related more to jqGrid than to the strongly typed helper which is part of Lib.Web.Mvc.

I would suggest going through jqGrid documentation and demos in order to understand how it really works. Please remeber that Lib.Web.Mvc provides only a wrapper around it which simplifies a lot of its usage in ASP.NET MVC.

If it comes to inline editing, you can find details here, but long story short jqGrid doesn't suport any of those things out-of-the-box. You will have to rewritte some internals and use some tricks. I would suggest going through StackOverflow in search of answers for similiar issues.