BusinessRx Community

Dedicated to the advancement of software, technology and the people who devote their lives to it.

Welcome to BusinessRx Community Sign in | Join | Help
in Search

BusinessRx Reading List

These blog entries are written by industry experts and leaders. We consider this content to be a good read for any software developer or web technologist.

Disabling the Submit Button Until a CheckBox is Checked

A little over a year ago I created two ASP.NET validation controls that are missing from the ASP.NET Toolbox: CheckBoxValidator and CheckBoxListValidator. As their names imply, these validation controls validate a single CheckBox (ensuring its either checked or unchecked, depending on a property setting) and ensures that a specified minimum number of options are checked from a CheckBoxList. For some reason, the built-in ASP.NET validation controls do not validate against CheckBoxes.

I recently updated the CheckBoxValidator control so that a page developer can optionally associate a Button, LinkButton, or ImageButton with the validator. In such a case, the CheckBoxValidator injects client-side script so that the associated button is disabled when the CheckBox is in the inappropriate check state, and enabled otherwise. 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.

You can read more about this enhancement at Disabling the Submit Button Until a CheckBox is Checked. The complete source code and a simple working demo is available here.

Published Tuesday, December 18, 2007 10:45 AM by Scott on Writing

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

No Comments

Leave a Comment

(required) 
(optional)
(required) 
Submit
Powered by Community Server, by Telligent Systems
'