Validating a group of checkboxes in asp net

18-Aug-2015 05:16

We can access the check box in grid control in client side using java script.When there are two recipients groups available to user to send messages to them Group 1 user will be allow to send one recipient at a time , for Group 2 he will Full Name: ravi kasarla Member Level: Starter Member Status: Member Member Since: 6/30/2011 AMCountry: India Ravi Kasarla , i am currently working for oztek software pvt ltd as a web developer.i am having 1.5 years experience on frame work and php.Hello Ziad, Checkboxes by nature are optional and not required.You can perform custom validation when you submit the form and prevent submitting if there are no checked checkboxes.If not, an alert is displayed and focus is moved to the checkbox.Not the prettiest solution, but functional in all browsers with Java Script enabled.When the checkbox is not checked and the Submit button is clicked an alert is displayed similar to the examples above, but using our text instead of the default.

All you need to do is include a This tells the browser that the form should not be allowed to submit without the checkbox checked.

The event handler on the checkbox then toggles the error message.

When the checkbox is valid (checked) the message is set to blank which tells the browser that it's ok for the form to be submitted.

As we've see in other articles the valid/invalid state of a form element can be used to provide visual feedback to the user - displaying a green thumbs up or checkmark for example when the input requirements have been satisfied, or displaying a red outline or warning symbol when they have not.

This is also possible with text will now toggle the checkbox state, and the text will change from red to green.

All you need to do is include a This tells the browser that the form should not be allowed to submit without the checkbox checked.

The event handler on the checkbox then toggles the error message.

When the checkbox is valid (checked) the message is set to blank which tells the browser that it's ok for the form to be submitted.

As we've see in other articles the valid/invalid state of a form element can be used to provide visual feedback to the user - displaying a green thumbs up or checkmark for example when the input requirements have been satisfied, or displaying a red outline or warning symbol when they have not.

This is also possible with text will now toggle the checkbox state, and the text will change from red to green.

If you're using Safari or another unsupporting browsers all the examples will just display the Java Script alert box.