38 users online (0 members and 38 guests)  


  Results 1 to 2 of 2

Related

  1. VBScript/Html Help    Forum: HTML Forum
    Replies: 1
  2. Vbscript/html Checkbox    Forum: HTML Forum
    Replies: 0
  3. VBscript difficulty    Forum: Website Scripts Forum
    Replies: 1
  4. HTML/VBSCRIPT checkbox help    Forum: Website Scripts Forum
    Replies: 7
  5. VBScript Functions    Forum: Website Scripts Forum
    Replies: 1
  1. #1
    fjmang's Avatar
    New User

    Status
    Offline
    Join Date
    Mar 2007
    Posts
    1

    VBscript Check box help

    Hey, I'm trying to get back into programming and figure out this problem. I have check boxes that I want users to click on. What I want to happen is if they select both checkbox 1 and 2, then they cannot select checkbox 3. and if they select checkbox 3, they cannot select checkbox 1 or 2... here is the code i thought would work

    If Form1.elements(1).checked = True and
    Form1.elements(2).checked = True Then
    Form1.elements(3).checked = False
    End If

    I appreciate any help

  2. #2
    DeadMeatGF's Avatar
    Moderator

    Status
    Offline
    Join Date
    Sep 2005
    Posts
    381

    Re: VBscript Check box help

    I'm not into VBScript, but I assume the commands are linked to an event?
    If so, in theory you'd need to run the check on checkbox 1 & 2 : something along the lines of
    Code:
    CheckBox1.onchange() {
      If (Form1.CheckBox1.checked = True and Form1.CheckBox2.checked = True)
        Then (Form1.CheckBox3.disabled = True)
        Else (Form1.CheckBox3.disabled = False)
      End If
    }
    
    CheckBox2.onchange() {
      If (Form1.CheckBox1.checked = True and Form1.CheckBox2.checked = True)
        Then (Form1.CheckBox3.disabled = True)
        Else (Form1.CheckBox3.disabled = False)
      End If
    }
    
    SubmitButton.OnClick() {
      If (Form1.CheckBox1.checked = True and Form1.CheckBox2.checked = True)
        Then (Form1.CheckBox3.checked = False)
      End If
    }
    Note: This is pseudo code as I don't know how to lay out VBScript!
    If that works, you can't alter CheckBox3 or submit it as checked if 1 & 2 are checked, but if you uncheck 1 or 2 it "remembers" how you had 3 previously.



Tags for this Thread