<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Pass Array to getElementById - Disable/Enable layer checkboxes in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/pass-array-to-getelementbyid-disable-enable-layer/m-p/306235#M28106</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I just started Javascripting about a week ago and have had fairly good success with the API, but need a little push to make a bit of code more efficient.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a number of html inputs "checkbox", "button" that control layer visbility. They all contain the " disable " attribute by default so that they are not useable when the application loads. The dependent layers are not functionally useful until the map is zoomed into about the 6th - 11th scale levels.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;On "extentChange", at a specified scale, I fire off a function to remove the " disabled " attribute from the inputs thereby enabling them and vice versus when zomming back out.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, the only way I have found to make this work is by using "getElementById" which natively only supports the passing of "1" specific "Id", which would mean that I would have to have 35 nearly idenitcal functions, which is very inefficient...or find a way to pass an array of Ids to it...looked into it...couldn't figure it out.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Since all of the inputs in question are the "only" input tags in the app I tried the getElementsByTagname("input"), but I haven't yet figured out how to loop through the resulting NodeList, or Array, to affect the change on all of them.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is what I am using currently:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;//Listener&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dojo.connect(map, "onExtentChange", bufferInputControl);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;//Function&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;function bufferInputControl (extent, delta, outLevelChange, outLod) { &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; var inputOffOn = document.getElementById('0');&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; if (outLod.level &amp;lt; 6) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; inputOffOn.disabled = true;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; } else{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; inputOffOn.removeAttribute("disabled");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;//Input&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;input&amp;nbsp; disabled type='checkbox' class='list_item' id='0' value=0 onclick='updateLayerVisibility();'/&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anybody have any thoughts on how to make this most efficient for controlling the " disabled " attribute of 35 Inputs?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 21 May 2010 12:40:16 GMT</pubDate>
    <dc:creator>KeithSandell</dc:creator>
    <dc:date>2010-05-21T12:40:16Z</dc:date>
    <item>
      <title>Pass Array to getElementById - Disable/Enable layer checkboxes</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/pass-array-to-getelementbyid-disable-enable-layer/m-p/306235#M28106</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I just started Javascripting about a week ago and have had fairly good success with the API, but need a little push to make a bit of code more efficient.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a number of html inputs "checkbox", "button" that control layer visbility. They all contain the " disable " attribute by default so that they are not useable when the application loads. The dependent layers are not functionally useful until the map is zoomed into about the 6th - 11th scale levels.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;On "extentChange", at a specified scale, I fire off a function to remove the " disabled " attribute from the inputs thereby enabling them and vice versus when zomming back out.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, the only way I have found to make this work is by using "getElementById" which natively only supports the passing of "1" specific "Id", which would mean that I would have to have 35 nearly idenitcal functions, which is very inefficient...or find a way to pass an array of Ids to it...looked into it...couldn't figure it out.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Since all of the inputs in question are the "only" input tags in the app I tried the getElementsByTagname("input"), but I haven't yet figured out how to loop through the resulting NodeList, or Array, to affect the change on all of them.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is what I am using currently:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;//Listener&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dojo.connect(map, "onExtentChange", bufferInputControl);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;//Function&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;function bufferInputControl (extent, delta, outLevelChange, outLod) { &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; var inputOffOn = document.getElementById('0');&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; if (outLod.level &amp;lt; 6) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; inputOffOn.disabled = true;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; } else{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; inputOffOn.removeAttribute("disabled");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;//Input&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;input&amp;nbsp; disabled type='checkbox' class='list_item' id='0' value=0 onclick='updateLayerVisibility();'/&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anybody have any thoughts on how to make this most efficient for controlling the " disabled " attribute of 35 Inputs?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 May 2010 12:40:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/pass-array-to-getelementbyid-disable-enable-layer/m-p/306235#M28106</guid>
      <dc:creator>KeithSandell</dc:creator>
      <dc:date>2010-05-21T12:40:16Z</dc:date>
    </item>
    <item>
      <title>Re: Pass Array to getElementById - Disable/Enable layer checkboxes</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/pass-array-to-getelementbyid-disable-enable-layer/m-p/306236#M28107</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Check out dojo.query:&amp;nbsp; &lt;/SPAN&gt;&lt;A href="http://docs.dojocampus.org/dojo/query"&gt;http://docs.dojocampus.org/dojo/query&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This would disable all your checkboxes:&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;dojo.query('input').attr('disabled', 'disabled');&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 May 2010 15:31:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/pass-array-to-getelementbyid-disable-enable-layer/m-p/306236#M28107</guid>
      <dc:creator>DerekSwingley</dc:creator>
      <dc:date>2010-05-21T15:31:32Z</dc:date>
    </item>
  </channel>
</rss>

