Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need conditional function

Status
Not open for further replies.

Barkley564

Technical User
Nov 27, 2004
14
US
I've inherited some code that doesn't work properly. There are two functions involved in the problem. The first one calls the second one with this code:

Code:
for (var x = 1; x <= document.all.maxBehavioralID.value; x++)
		ResetRadioSelection(x);

The next function is:
Code:
function ResetRadioSelection(IndexID)
{
	switch(IndexID)
	{
		case 1:
			document.all.radio1[0].disabled=false;
			document.all.radio1[0].checked=false;
			document.all.radio1[1].disabled=false;
			document.all.radio1[1].checked=false;
			break;
		case 2:
			document.all.radio2[0].disabled=false;
			document.all.radio2[0].checked=false;
			document.all.radio2[1].disabled=false;
			document.all.radio2[1].checked=false;
			break;
<snip> repeated to case 20
It works great if the user has all 20 behavioral id's, but some don't, and it will fail on the first one they don't have. I get the is null or not an object error, and any buttons after the place it fails does not reset.

I do have a field that tells me whether a value is used for the person being queried, but I'm not sure how to make that happen. Can you use an if statement in a function? If so, how?

I'm a novice with asp so I apologize if I didn't explain this properly.

Any suggestion is appreciated!
 
This question would be more appropriate in the javascript forum: forum216

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top