Solved

Dojo Check Box easy question.

Posted on 2008-10-16
Medium Priority
1,013 Views
I have a dojo check box that all I am trying to do is find out if it is checked or not.  If it is checked I want it to turn a layer on in my map and if it is not then turn the layer off.  The map part you do not need to worry about but the checked or not checked is really ticking me off.  This should be simple.
``````function changeMap(layers) {
var ShowLayerName, HideLayerName
if(layers === 'streetMap'){
//alert("Found streetMap - " + layers);
HideLayer([imageryPrime])
ShowLayer([streetMap])
}
if(layers === 'imageryPrime'){
//alert("Found imageryPrime - " + layers);
HideLayer([streetMap])
ShowLayer([imageryPrime])
}

if(layers === 'streetMap2'){
//alert("Found streetMap - " + layers);

var layer3 = "streetMap"
var tmpTA = dojo.byId("chkTA");
if (layer3.visible){
tmpTA.Checked = false;
HideLayer([streetMap])
}
else{
tmpTA.Checked = true;
HideLayer([imageryPrime])
ShowLayer([streetMap])
}

if(dijit.byId('chkTA').Checked){
alert("Found chkTA True - " + layers);
}
else
{
alert("Found chkTA False- " + layers);
}
//HideLayer([imageryPrime])
//ShowLayer([streetMap])
}
}

function ShowLayer(layers) {
//hideImageTiledLayers(layers);
for (var i=0; i<layers.length; i++) {
layers[i].show();
}
}

function HideLayer(layers) {
//hideImageTiledLayers(layers);
for (var i=0; i<layers.length; i++) {
layers[i].hide();
}
}

<input id="chkTA" dojotype="dijit.form.CheckBox" name="chkTA" value="streetMap2" type="checkbox" onclick="changeMap(this.value);"/>
<label for="chkTA"> Street Layer </label>
``````
0
Question by:flfmmqp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 2
• 2

LVL 10

Accepted Solution

Bane83 earned 2000 total points
ID: 22735222
Lowercase C: tempTA.checked.
0

Author Comment

ID: 22758657
I hate it when it is so easy.  Thanks.
0

LVL 10

Expert Comment

ID: 22759168
You should love it when it's that easy.  It means you can get back to work sooner rather than banging your head trying to figure out a work around. :)
0

Author Closing Comment

ID: 31506728
Thanks for the help and sorry for the late response.
0

Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses
Course of the Month10 days, 19 hours left to enroll