Introduction:
In this blog we will see how to Validating Form Fields using JavaScript
function validateDateField(executionContext) {
var formContext = executionContext.getFormContext();
if (formContext.getAttribute("bosch_destinationdate").getValue() != null &&
formContext.getAttribute("bosch_sourcedate").getValue() != null) {
if (formContext.getAttribute("bosch_destinationdate").getValue() < formContext.getAttribute("bosch_sourcedate").getValue()) {
var alertStrings = { confirmButtonLabel: "Yes", text: "Destination Date Should be Greater", title: "Date Alert" };
var alertOptions = { height: 120, width: 260 };
Xrm.Navigation.openAlertDialog(alertStrings, alertOptions).then(
function (success) {
console.log("Alert dialog closed");
},
function (error) {
console.log(error.message);
}
);
}
}
}
No comments:
Post a Comment