Skip to content

Instantly share code, notes, and snippets.

@furkankaracan
Last active September 13, 2022 10:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save furkankaracan/2891e12ce38ac1d8ac2c74b3f4288c2c to your computer and use it in GitHub Desktop.
Save furkankaracan/2891e12ce38ac1d8ac2c74b3f4288c2c to your computer and use it in GitHub Desktop.
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