I need to create a radio button to control the �??turn on/off�?? function of several layers. The ESRI sample below provides a Legacy codes, but what I need is AMD style. http://developers.arcgis.com/javascript/sandbox/sandbox.html?sample=layers_web_tiledHere is the code I build so far, radio button just can not show up in my �??toggle2�?? div. Any hints will be great help. Thanks! var selectLayers = [];
//river and feature4 are two layers I already created
selectLayers.push({ layer: rivers, title: "Rivers" });
selectLayers.push({ layer: feaLayer4, title: "Cities and Places" });
//var layerDiv = dojo.create("div");
arrayUtils.forEach(selectLayers, function (slayer) {
radioName = slayer.title;
alert("The Radio Button Name is " + radioName); //This is to test my radio button name is correct
var radioButton = new RadioButton({
"checked": slayer.layer.visible,
"name": "radioButton" + slayer.layer.name,
"value": slayer.layer.name
}); // new RadioButton() ends here
//Add Radio Button to the page
domConstruct.place(radioButton.domNode, "toggle2", "after");
var radioLabel = domConstruct.create('label', {
'for': radioButton.name,
innerHTML: radioName,
}, radioButton.domNode, "after");
domConstruct.place("<br/>", radioLabel, "after");
}); // Radio Button forEach( ) ends here