How to read the start date value to validate enddate value before saving a record

Hello Community,

 

I wanted to validate Start date and enddate. For start date I will use current date to validate. But to validate EndDate I wanted the value of Startdate field. 

I want to know how to read the startdate attribute value in the end date validator. 

I am able to get the value of the attribute in handler, But i could not get value in the validators

"usr.usrenddatevalidator":{

                "validator": function(config){

                    return function(control){

                        var date1 = new Date();

                        var date2 = new Date(control.value);

                        var date3 = startdateAttributeValue;

                        return (date2 < date1 || date3 >= date2) ?  {"usr.usrenddatevalidator": { message: config.message }} : null;

                    };

                },

                "params":[

                    {"name":"message"}

                   ],

                "async":false

            },

Thanks in Advance 

Gargeyi.G

 

Like 0

Like

1 comments

Hello Gargeyi,

 

Unfortunately there is no way to get data from other controls on the page in the context of validator execution triggered on some of the controls on the page. I've asked our core R&D team to add the possibility to operate with other controls values in terms of validator execution. Thank you for helping us in making the app better!

Show all comments