Validating controls for group resolution

Source: Internet
Author: User

The approximate implementation process is as follows:

1, add properties to the validation control: validationgroup= "VgA" (group name casually write)

2, modify the properties of the Save button: Causesvalidation=false

3, add onclientclick= validatebygruop to the Save button ()

The code is as follows:

 

   function  validatebygruop ()

    {

&N bsp;    var Retval=false;

     var val = $ (' #<%= drop-down list control Id.clientid%> option:selected '). Val ();

     if (val = 1)

     {

         //Validate only mining required

          retval= page_clientvalidate ("mustvalidate");

    }

     else  

     {

        //Validate all items

  & nbsp;       retval= page_clientvalidate ();

    }

     return retval;

}

4, if you want to use the ValidationSummary control to display the summarized validation information, set its validationgroup= "group name" to

Supplementary notes;

1,page_clientvalidate method

Page_clientvalidate (ValidationGroup)

The parameter is the value of the ValidationGroup property. Validator control that triggers all pages of a page without specifying a parameter.

The return value is a Boolean value (true: validation passed, false: Validation failed).

2, on a page containing RequiredFieldValidator controls, RequiredFieldValidator controls are sent to the client to generate some web effects functions, causesvalidation= "True" button is only a bit more JavaScript code than the button causesvalidation= "False"

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.