Skip to content

Instantly share code, notes, and snippets.

@furkankaracan
Last active September 13, 2022 10:34
Embed
What would you like to do?
EndDateValidationWithFormNotification: function (executionContext) {
var formContext = executionContext.getFormContext();
var startDate = formContext.getAttribute("my_startdate").getValue();
var endDate = formContext.getAttribute("my_enddate").getValue();
if(endDate > startDate)
formContext.ui.clearFormNotification("EndDateValidation");
else{
formContext.ui.setFormNotification("End Date must be bigger than Start Date", "ERROR", "EndDateValidation");
formContext.getAttribute("my_enddate").setValue(null);
}
},
EndDateValidationWithIsValid: function (executionContext) {
var formContext = executionContext.getFormContext();
var startDate = formContext.getAttribute("my_startdate").getValue();
var endDate = formContext.getAttribute("my_enddate").getValue();
var valid = endDate > startDate;
formContext.getAttribute("my_enddate").setIsValid(valid, "End Date must be bigger than Start Date");
formContext.getAttribute("my_enddate").setValue(null);
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment