;

PDA

Click to See Complete Forum and Search --> : Checking the status of a checkbox - tutorial


dniezby
12-18-2005, 04:41 PM
For new KM Coders....I thought I'd post something that I actually learned on my own :) so that others may learn.

To check the status of a checkbox:

// Check to see if the checkbox is checked or unchecked.

// Assign a variable to the checkbox instance.
variable_name = instance_name.getValue();

//Check condition
if (variable_name == true) {
//perform action if checked
}else{
//perform action if unchecked
}


Simple enough huh? I used this to hide a navigation button if the checkbox was unchecked and it worked beautifully. I know new users will probably run into the problem I had creating this simple code...I wasn't assigning a variable to the checkbox. I foolishly thought that renaming the checkbox was enough.