Complex checkbox validation question(s)

Posted on 2009-02-20
Last Modified: 2013-11-23
I have a request to create multiple "sections" with multiple checkboxes underneath and they have requested:

"...If EITHER one of SECTION TITLE A is NOT checked off (i.e., has to check ALL to proceed) or if either of SECTION TITLE B IS checked-off, then a pop-up window should come up saying:  yaddayaddayadda.  When the user clicks OK, they are re-directed to another page.

...or if ALL of SECTION TITLE A are checked off and NONE of SECTION TITLE B are checked off, then force to save and load a specific page.

...and if ALL of SECTION TITLE A are checked off, NONE of SECTION TITLE B are checked off, and ANY warnings are checked off, a popup should come up: Warning!"

Is this actually doable? The person requesting isn't sure but would like it if possible. I have already created all of the checkboxes and wording next to them, but am confused as to how I'd verify check/unchecked in multiple sections, or how to load a specific page based on results. (not a real programmer, just trying to help out until person returns...sorry for so many questions!)

Section Title A

q	option 1

q	option 2 

q	option 3

q	option 4

Section Title B

q	option 1

q	option 2

q	option 3

q	option 4

q	option 5


q	option 1

q	option 2

Open in new window

Question by:Bulldog7
    LVL 15

    Accepted Solution

    Do you need the errors and warnings to pop up After a button is clicked?

    If so that's pretty simple, just a basic If/Then.

    Protected Sub Button1_Click()

       Dim GroupAChecked As Boolean
       Dim GroupBChecked As Boolean
       Dim GroupWarnings As Boolean

       If chkAOption1.Checked And chkAOption2.Checked And chkAOption3.Checked Then
            GroupAChecked = True
       End If

       If chkBOption1.Checked Or chkBOption2.Checked Or chkBOption3.Checked Then
            GroupBChecked = True    
       End If

      If chkWarning1.Checked Or chkWarning2.Checked Then
        GroupWarnings = True
      End If

       If Not GroupAChecked Then
           'do some stuff
       End If

       If GroupBChecked Then
           'do some other stuff
       End If

       If GroupWarnings Then
           'do other other stuff
       End If

    End Sub

    Author Comment

    aibusinesssolutions, I think just the warning has to come up and then either the page reloads or is directed to another page (of which I'm not really sure how THAT works either. I apologize for all of the questions, trying to help out a group, but have limited grasp beyond edits and adds...not to mention this somehow links back to SQL.

    When you write "do some stuff/do some other stuff" would that imply the loading or redirecting of pages?

    Author Comment

    ...also, what would be the easiest way to create "groups" of the 3 sections I have listed, so that they can be referenced as such in your code?

    Thank you for all of your advice btw...

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
    Adobe Dreamweaver CS5 is a WYSIWYG web page editor that has advanced HTML, CSS, and Javascript rendering functionality and is probably the most well-known HTML editor available. Much of Dreamweaver's appeal centers around the Design View interfac…
    Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
    Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now