validating radio option buttons 
Author Message
 validating radio option buttons

I have an asp page that dynamically writes out option buttons. IE

Category1
    ID1
    ID2
    ID4

Category2
    ID3
    ID5
    ID6

Category3
    ID7

Category4
    ID8
    ID9

Category and ID change based on what is in the db

Each Category and ID has an option button next to it with it value
coresponding to its Unique ID

I have a send button that adds the data selected to another table

I have been able to validate in JSCRIPT that 1 category and 1 ID has been
chosen by
writing this:

<script Language="JavaScript">
<!--
//This checks to see that a Category has been selected
function validateCategory()
{
  var radioSelected = false;
  for (i = 0;  i < document.thisForm.optPost.length;  i++)
  {
    if (document.thisForm.optPost[i].checked)
        radioSelected = true;
  }
  if (!radioSelected)
  {
    alert("You must select a Category.");
    thisPage.cancelEvent = true;
    return false;
  }
  return true

Quote:
}

//-->

<!--
//This checks to see that a Postcard message has been selected
function validateID()
{
  var radioSelected = false;
  for (i = 0;  i < document.thisForm.optID.length;  i++)
  {
    if (document.thisForm.optID[i].checked)
        radioSelected = true;
  }
  if (!radioSelected)
  {
    alert("You must select a corresponding ID for a postcard.");
    thisPage.cancelEvent = true;
    return false;
  }
  return true

Quote:
}

//-->
</script>

Whats the best way to write this in VB SCRIPT?

Also
I need to verify that at least 1 of the IDs is selected, AND it has to
be
an ID listed under the Category chosen.  (ie if user selects Category4 they
MUST choose radio button ID8 or

ID9)

Ideally I would like it so that if I user checks A category then
automattically the an ID below it gets

checked.  Likewise if the user selects an ID first, then the corresponging
Category will get selected.  (ie if

user selects ID8 then Category4 automatically get selected.

Thanks in advance!



Wed, 28 Apr 2004 03:45:11 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. validating radio option buttons for Category & SubCategory

2. Validating Radio Buttons?

3. Validate radio button and/or checkboxes for input

4. Way to validate radio button using Jscript?

5. trying to validate radio button groups

6. Validating Checkbox/Radio Button

7. validating radio buttons

8. radio buttons and validating an asp page...

9. Validating Radio Buttons

10. Making radio (option) buttons toggle

11. Simulate a grid in VB6 with radio button options in a column

12. Radio / Option Buttons

 

 
Powered by phpBB® Forum Software