Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

EFORM CHECKBOX

Posted on 2009-05-02
4
Medium Priority
?
716 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 10

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 10

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Recently I finished a vbscript that I thought I'd share.  It uses a text file with a list of server names to loop through and get various status reports, then writes them all into an Excel file.  Originally it was put together for our Altiris server…
This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

604 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