?
Solved

EFORM CHECKBOX

Posted on 2009-05-02
4
Medium Priority
?
712 Views
Last Modified: 2012-05-06
On E-form I have 120 checkboxes. On load at least 1 needs to be checked. what code would I used to give error message.

What I have is if obform.checkbox.all = 0 then  
0
Comment
Question by:codefnder
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 9

Expert Comment

by:Tom
ID: 24307154
if obform.checkbox.checked = False then  
Borlean value here:    .checked = True or False

Public Sub Test()
    set input_elements=document.frmname.getElementsByTagName("input")
    for i=0 to input_elements.length-1
        if input_elements(i).type="checkbox" then
                  if input_elements(i).checked=true Then Exit Sub
        end if
    next
' give error message here'
End Sub

Open in new window

0
 

Author Comment

by:codefnder
ID: 24336083
I am receiveing error message when i add this code to my procedure.

The error reads sub is undefined

here is my code


   
   Sub Test()      

    set input_elements=document.OBform.getElementsByTagName("input")
    for i=0 to input_elements.length-1
     if input_elements(i).type="checkbox" then
     if input_elements(i).checked=true Then Exit sub
     end if
     next
    Call msgbox(" Please choose at least 1 Approval option type ", 64, "Error!")
    OBform.OBKey_FeeType_1.FOCUS

  end sub
 
-->
</SCRIPT>

<FORM name=OBForm
action=http://kmweb    Call msgbox(" Please choose at least 1 Approval option type ", 64, "Error!")
    OBform.OBKey_FeeType_1.FOCUS

  end sub
 
-->
</SCRIPT>

<FORM name=OBForm
action=http://kmweb
0
 
LVL 9

Accepted Solution

by:
Tom earned 2000 total points
ID: 24344345
OK let me give you a full example you can look at:

<html>
    <head>
        <title>Checkbox</title>
        <script language="vbscript">
        <!--
        sub frmname_onClick
            for each x in document.frmname
                if x.type = "checkbox" then
                    if x.checked = true then
                    exit sub
                    end if
                end if
            next
           
        msgbox "you must select one  "  
        end sub
        -->
        </script>
    </head>
   
    <body>
        <form method="POST" name="frmname">
            <input type="checkbox" name="CH1" /><br/>
            <input type="checkbox" name="CH2" /><br/>
            <input type="checkbox" name="CH3" /><br/>
            <input type="checkbox" name="CH4" /><br/>
            <input type="checkbox" name="CH5" /><br/>
            <input type="checkbox" name="CH6" /><br/>
            <input type="checkbox" name="CH7" /><br/>
            <input type="checkbox" name="CH8" /><br/>
            <input type="checkbox" name="CH9" /><br/>
            <input type="checkbox" name="CH10" /><br/>
            <input type="checkbox" name="CH11" /><br/>
            <br/><br/><input type="submit" value="Submit" name="B1">
        </form>
    </body>
</html>

0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This script will sweep a range of IP addresses (class c only, 255.255.255.0) and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

777 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