empicard

Stuck on a radio button?

Discussion created by empicard on Feb 24, 2012
Latest reply on Feb 27, 2012 by empicard
Ive got a radio button:

            <form id="myform" >
                <H3>Select</H3>
                <input type="radio" name="selectingTool" id="radioOne" checked value="District"/> <label for="radioOne">District</label> <br />
                <input type="radio" name="selectingTool" id="radioTwo" value="Division"/> <label for="radioTwo">Division</label> <br />
                <button id="buttonbutton" onclick=searchChoice()>Apply</button>
            </form>


I want to use this  to select which layer is queried:
        function searchChoice() {
          alert(dojo.byId("radioOne").value);
              switch (dojo.byId("selectingTool").value) {
              case "District":
                dojo.connect(districtLayer, 'onClick', function(evt){
                  alert("hi");
                  //select the clicked feature

                  var query = new esri.tasks.Query();
                  query.geometry = evt.mapPoint;
                  districtLayer.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_NEW);
                }); //end of onClick...
                break;
              case "Division":
                dojo.connect(divisionLayer, 'onClick', function(evt){
                  //select the clicked feature
                  var query = new esri.tasks.Query();
                  query.geometry = evt.mapPoint;
                  divisionLayer.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_NEW);
                }); //end of onClick...
                break;
            };  
        };         
      


Instead of any of that  the whole page redraws. why does it redraw?!
in 1 or 2 of my 1000 or so attempts I've gotten the value of the selecting tool to change to "district" but never division.
Sorry if its a little messy, ive changed things back and forth 1000 times today.
And, how do I get to radioTwo??!


Please help.
Thank you,
Evan

Outcomes