Solved

EFORM CHECKBOX

Posted on 2009-05-02
4
663 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

In this article we want to have a look at the directory attributes which are used by Microsoft to store the so called Security Identifiers (SID). These SIDs plays an important role in delegating and granting permissions and in authentication of trus…
When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

757 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

19 Experts available now in Live!

Get 1:1 Help Now