Dynamic CRM 2013 Learning Notes (24) Logic verification before saving page

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.