# \[mx\] modifying checkboxes component code to assign single variables

**URL:** <https://forum.kirupa.com/t/mx-modifying-checkboxes-component-code-to-assign-single-variables/92132>\
**Category:** Uncategorized\
**Created:** [October 13, 2003, 7:38pm UTC](https://forum.kirupa.com/t/mx-modifying-checkboxes-component-code-to-assign-single-variables/92132 "2003-10-13T19:38:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chartrandi](https://avatars.discourse-cdn.com/v4/letter/c/e0b2c6/32.png) [@chartrandi](https://forum.kirupa.com/u/chartrandi)\
**Post date:** [October 13, 2003, 7:38pm UTC](https://forum.kirupa.com/t/mx-modifying-checkboxes-component-code-to-assign-single-variables/92132/1 "2003-10-13T19:38:49Z")

</div>

RE : code taken from [Kirupa.com](http://Kirupa.com)’s form tutorial  
[here is my published swf](http://www.geocities.com/chartrandi/testing_help.html)

Hi, could anyone help me modify the code for these checkbox components?

right now, the SUBMIT button checks which ones of the checkboxes are checked and gets their label, then  
writes the appropriate labels in a dynamic text box.

// HERE IS THE CODE FOR THE Checkbox Components-----------

// Array of the instance names of the checkboxes  
myCheck = [one,two,three,four,five,six,seven,eight,nine]; // Function  
function checkDisplay(component) {  
var j,s;  
for(j in myCheck){  
if(myCheck[j].getValue()) s += myCheck[j].getLabel()+"  
";  
}  
checke = ((s.length) ? s : “Nothing”);  
}

// As usual…  
for (i=0;i\<myCheck.length;i++) {  
myCheck\*.setChangeHandler (“checkDisplay”) ;  
}

// Push Buttons  
// ---------------

// Reset button function  
onReset = function () {  
// checkbox  
var j;  
for (j in myCheck) {  
myCheck[j].setValue(false);  
//vider la boite texte  
result.text = “”;  
}

}  
// Submit button function  
onSubmit = function () {  
texte = comment.text;

```
//to make choice appear in dynamic text box
result.text+= checke;

```

}

For the program I am doing, I need to have a maximum of 6 checkmarks and each one of the checked label must  
go into its own variable. (see gray part of the swf)  
I would also like the labels to appear in the right order, right now it’s inversed.

please see source file:

[FLA source file](http://geocities.com/chartrandi/testing_help.fla)

thanks…a lot! 🙂  
-Isabelle
