Home  >  Article  >  Web Front-end  >  Dynamic CRM 2013 Study Notes (Twenty-Four) Logic verification before saving the page_html/css_WEB-ITnose

Dynamic CRM 2013 Study Notes (Twenty-Four) Logic verification before saving the page_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:51:161367browse

We sometimes need to verify some logic on the page, for example, the start time cannot be later than the end time, and if it is not in time, it will not be saved. We can handle related field events, but this will be more troublesome if there are many fields to be judged. At this time, we can use the OnSave event of the Form. The specific method is introduced below:

1. The OnSave event of the Form

2. JS method

function formSave(context) {
    if (!dateCheck("new_valid_on", "new_valid_to")) {
        alert("Valid To is earlier than Valid On !")
        context.getEventArgs().preventDefault();
    if (!dateCheck("new_valid_from", "new_valid_to")) {
        alert("Valid To is earlier than Valid From !")
        context.getEventArgs().preventDefault();

Use this sentence to block when the conditions are not met Save:

context.getEventArgs().preventDefault();

Isn’t it very simple, no need to do it for every Write a method for each related field.

Dynamic CRM 2013 study notes series summary -- continuously updated

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn