How to add Checked Boxes on tree to get request?

I have added a tree component to a form that is already populated by several html form inputs. I would like to be able to add the tree’s checked boxes to the submit url. How can I do this?

Current java script:
function on SubmitEvent() {
var elmTree = window[“my_tree”];
if (elmTree != null){
var checkedBoxes = elmTree.getAllChecked();
if (checkedBoxes != ‘’){
alert("These are checked in my_tree: " + checkedBoxes);
return true;
} else {
alert(“Please check at least one box.”);
return false;

What I would like to do is, instead of calling the alert showing what is checked, I’d like to add variables corresponding to each checkboxId with the value “on” (e.g., “&chkbx1=on&chkbx4=on”, etc.) In other words, I’d like to, in effect, treat the tree checkboxes as though they were html input check boxes (which is actually what I’m replacing with the tree).

How can I do this?

Tree checkboxes are images. So their states aren’t submitted. You can place some hidden input inside your form and place ids of checked items in this input:

document.getElementById(“id_of_hidden_input”).value = tree.getAllChecked();

Thank you. That worked fine!