GeekArticles
Database
SQL ServerDisabling the Submit Button Until a CheckBox is Checked
Author: aspnet.4guysfromrolla.com |
Published: 20th Dec 2007 |
Visited: 78 times |
Add CommentFiled in: SQL Server
ASP.NET provides a variety of validation Web controls that can be used to validate a user's form field inputs.
Unfortunately, the validation Web controls do not work with the CheckBox or CheckBoxList Web controls. In a previous article,
Creating Validator Controls for the CheckBox and CheckBoxList,
I shared two custom controls I had created to address this shortcoming: CheckBoxValidator and CheckBoxListValidator. These controls
work like any other ASP.NET validation control - at a minimum, just add them to a page and specify their ControlToValidate and
ErrorMessage properties.
A colleague recently asked me to enhance the CheckBoxValidator control's client-side script so that it could optionally disable a particular
button when invalid. In particular, she wanted to be able to specify the ID of a Button control in the CheckBoxValidator's properties.
The CheckBoxValidator would then use client script to disable (gray out) the Button when the CheckBoxValidator was invalid. The following screen shot
illustrates this concept. On the left, the CheckBox is unchecked so the Submit button is grayed out; on the right, the CheckBox has been checked so
the Button has become enabled.
I recently updated the CheckBoxValidator to meet these specifications. Read on to learn more about this new enhancement to the CheckBoxValidator!
Read More >
Read Article Sponsored Links
Related Articles
• Hint for "Delete" button says "Refactor" QC#: 59251 Version: 11.2 Status: Open defect, requires resolution Description: In the toolbar of the "Find references" result panel there are two buttons: "Delete" and "Delete All".
The popup hint for the "Delete" button is incorrect: it says "Refa ...