# Help with check box

**URL:** <https://forum.kirupa.com/t/help-with-check-box/287919>\
**Category:** flash\
**Created:** [May 7, 2009, 8:33pm UTC](https://forum.kirupa.com/t/help-with-check-box/287919 "2009-05-07T20:33:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rondog](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/rondog/32/2478_2.png) [@rondog](https://forum.kirupa.com/u/rondog)\
**Post date:** [May 7, 2009, 8:33pm UTC](https://forum.kirupa.com/t/help-with-check-box/287919/1 "2009-05-07T20:33:19Z")

</div>

I have a series of check boxes. The user must select the ones that are predefined in an array. If they have all of the right ones selected, they continue, if they have one selected that shouldn’t, it fails.

That all works fine for me. My question is, if the user has none selected, allCorrect is true which it shouldn’t be. My logic is almost there, but needs some help…what should I do?

```auto

private var correctAnswers:Array = new Array("a","c");
private function onSubmit(event:MouseEvent):void
{
	var allCorrect:Boolean = true;
	for (var i:int = 0; i < options.length; i++)
	{
		var target = questionHolder.getChildByName("cb" + i);
		if (target.selected == true)
		{
			if (correctAnswers.indexOf(target.label.substr(0,1).toLowerCase()) == -1)
			{
				//trace("wrong");
				allCorrect = false;
			}
			else
			{
				//trace("correct");
			}
		}
	}
	trace(allCorrect);
}	

```
