Validating checkbox in javascript

posted by | Leave a comment

If you set a validation control's , stating: "Control 'control ID' referenced by the Control To Validate property of 'validation Control ID' cannot be validated." There may be times, however, when you need to provide validation for a Check Box or Check Box List.Many Web pages with Terms of Service include a Check Box titled "I agree to the above terms" that must be checked before continuing.To provide such validation, we have three choices: In this article we'll implement the third option, creating two custom server controls, Check Box Validator and Check Box List Validator. The server controls provided in this article were designed using Visual Studio 2005 and the . NET 1.x, check out Creating a Validation Control for Check Box Lists.The download at the end of this article includes both the entire source code and a compiled assembly that you can drop into your ASP. NET Framework 2.0's base class libraries; consequently, they will only work in ASP. Alternatively, you may adapt the code presented here to work in ASP. The server controls examined in this article were designed using Visual Studio 2005 and the . NET 1.x, check out Creating a Validation Control for Check Box Lists. NET provides a variety of validation Web controls that can be used to validate a user's form field inputs. NET 2.0 for the validation control changes from ASP. NET version 2.0.) Unfortunately, the validation Web controls do not work with the Check Box or Check Box List Web controls. for general information on the validation Web controls and Dissecting Validation Controls in ASP.

The password won't appear on the screen as you type and most browsers also won't 'remember' the values entered in fields as they do with other form elements.

Since I see you are using j Query this is what I'd recommend doing.

First off, add a class to all the checkboxes What exactly didn't work @Joe M ?

If said value is undefined, the javascript returns false.

In my example I declare a variable with the value of the radio buttons.

Leave a Reply

method of documenting tracking and updating software licenses