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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dropdown & Checkbox validation script.

Status
Not open for further replies.

countdrak

Programmer
Jun 20, 2003
358
US
I have a page that displays order information for a customer. The page could have several items one under the other.

I have a check box and a drop down with each item. I just want the users to pick one option from the drop down when they click the check box for that item.

Its something like this

checkbox_1 Dropdown_1 --- -- -- -- --
checkbox_2 Dropdown_2 --- -- -- -- --

Now if they click checkbox 1 they need to pick something from dropdown1. The problem is the checkboxes and dropdowns are generated dynamically. So I could have 25 of these. Any help would be great...thanks
 
Code:
	function validate(){
		if ( thisform.checkboxlist.checked == true && thisform.reasonbox_34.selectedIndex == 0)

		{
			alert ("Please pick atleast one item the drop down.")
			return false;
		} 
		
		return false;
	}

Now I want to loop through all the checkboxes that have been checked and the checkbox has value thats unqiue.

Suppose the value of the check box is 34 then the select name is reasonbox_34.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top