0

I am a beginner with programming. I have created an HTML page with a text box, text area, select box, checkboxes, and radio buttons. I am trying to show how VBScript works with HTML for a class assignment. One of the tasks is to have a series of editing rules. The one I need help with is making sure that at least one checkbox is checked before the user can submit the form. How would I do this in VBScript?

Here is my code so far:

    <html>
<head>
<script language="vbscript">
<!--
sub fred





end sub
-->
</script>
</head>
<body>
<p>
<form name="f1">
<br>
Name <input type="text" name="nametext" size="30"><p>
List your favorite things to do <P><textarea name="bigtext" rows="5" cols="40">default value</textarea>

<p>What is your favorite animal to see at the zoo?

<select name="zooanimal">
  <option>default value
  <option>elephants
  <option>giraffes
  <option>tigers
  <option>seals
</select>

<p>

What is your favorite color?<br><p>
   blue <input name="rb" type="radio" value="bluechecked" checked> green <input name="rb" type="radio" value="greenchecked">
  pink <input name="rb" type="radio" value="pinkchecked"> yellow <input name="rb" type="radio" value="yellowchecked"> red <input name="rb" type="radio" value="redchecked"> black <input name="rb" type="radio" value="blackchecked"></p>

Which of these games do you play?<br><p>
  Starcraft <input name="game" value="Starcraft" type="checkbox"> World of Warcraft <input name="game" value="WorldofWarcraft" type="checkbox"> 
 League of Legends <input name="game" value="LeagueofLegends" type="checkbox"> none <input name="game" value="none"
 type="checkbox"><P>
 <p><input type="button" value="EDIT AND REPORT" onClick="fred">


<p>

<p>
</form>
</body>
</html>
1
  • 1
    No offense intended Krista, and you didn't ask but..... you should be using Javascript. Commented Apr 28, 2011 at 18:05

1 Answer 1

1
If (f1.rb.checked = True) Or (f1.game.checked = True) Then
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.