Solved

EFORM CHECKBOX

Posted on 2009-05-02
4
690 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
  • 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 500 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to Classify of email (pdf attachments) 7 45
VBScript Write Column Headers 3 41
Create Consolidation Sheet 3 38
get the ALL CAPITAL words from a cell 4 19
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…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

860 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