We sometimes have to verify some of the logic on the page, such as the start time can not be later than the end time, not to save. We can deal with the relevant field events, but this is more problematic if you want to judge the field more than once. At this time we can take advantage of the form of the OnSave event, the following describes the following specific practices:
1. OnSave Event for form
2. js method
function Formsave (context) {
if (!datecheck (" New_ Valid_on ", " new_valid_to ")) {
Alert ("Valid to be earlier than Valid on!")
Context.geteventargs (). Preventdefault ();
}
if (!datecheck (" New_ Valid_from ", " new_valid_to ")) {
Alert ("Valid to be earlier than Valid from!")
Context.geteventargs (). Preventdefault ();
}
}
Use this sentence to prevent saving when the condition is not met:
Context.geteventargs (). Preventdefault ();
is not very simple, do not have to write a method for each related field.
Dynamic CRM 2013 Learning Notes Series Rollup-ongoing updates
Dynamic CRM 2013 Learning Notes (24) Logic verification before saving page