title: Automatically filling in HTML form from array
body: <p>Intended Outcome: Automatically fill out a form on load using <code>document.getElementById</code>, javascript only. </p>
  
  <p>I have an array that passes into the following function, which correctly adds it to html script.     </p>
  
  <pre><code> function showResults(results) {
       var s = "";
       for (var i=0, il=results.features.length; i&lt;il; i++) {
           var featureAttributes = results.features[i].attributes;
  
           for (att in featureAttributes) {
               s = s + "&lt;b&gt;" + att + ":&lt;/b&gt;  " + featureAttributes[att] + "&lt;br /&gt;";
               // var subshed = feature[0].attributes["SubWS"];
  
           }
       }
       dojo.byId("info").innerHTML = s;
   }
  </code></pre>
  
  <p>The outcome looks like </p>
  
  <pre>
  OBJECTID: 190
  ProjectTyp: Stormwater Retrofit
  Unit: Lower
  SubWS: sadd
  </pre>
  
  <p>However, I need to modify the script to fill out an existing form with  </p>
  
  <pre><code>document.getElementById(att).value = featureAttributes[att]; 
  </code></pre>
  
  <p>I always seem to overwrite the final output so I only fill in a single form value.  How do I go about filling out multiple values?</p>
  
  <p>UPDATE: Mr. Polywhirl got it right.  I also had to add in an if statement to deal with null attribute values.  Final code was: </p>
  
  <pre><code> function showResults(results) {
              var subshed = results.features[0].attributes["SubWS"];
              //OBJECTID = results.features[0].attributes["OBJECTID"];
  document.getElementById("searchString").value = subshed;
                  console.log("feature", results.features[0].attributes["SubWS"])
  console.log(document.getElementById("Map_ID"));
          var s = "";
      for (var i = 0, il = results.features.length; i &lt; il; i++) {
            var featureAttributes = results.features[i].attributes;
            for (att in featureAttributes) {
          // s = s + "&lt;b&gt;" + att + ":&lt;/b&gt;  " + featureAttributes[att] + "&lt;br /&gt;";
    //         var subshed = feature[0].attributes["SubWS"];
  
                  //    document.getElementById(att).value = featureAttributes[att];
    if(!!featureAttributes[att]&amp;&amp;!!document.getElementById(att)){
                      document.getElementById(att).value = featureAttributes[att];
  
  
  }else{
  
  //alert(att + "this is null")
  
  }
            }
  
          }
  
       //   dojo.byId("info").innerHTML = s;
        }
  </code></pre>