title: Dynamically populate Contact Form 7 dropdown field with content from ACF field
body: <p>I have been using an old Wordpress contact form plugin (FastSecureContactForm) alongside some javescript someone built for me years ago to dynamically populate a field in the form with a dropdown list of file titles pulled from an ACF field. This has worked very well for me but I've rebuilt my website and am now using Contact Form 7 &amp; wish to repeat this functionality. </p>
  
  <p>The Javascript previously used referenced the ACF field from where it took the (multiple) track names as <code>track_name</code> and referenced the form field in FastSecureContactForm where the list of file names would be dynamically built as <code>si_contact_ex_field2_3</code> where the number 2 referenced Form 2 in the setup &amp; the number 3 referenced extra field 3 (<code>ex_field3</code>) on the form. The part of the javascript relating to this function is as follows (I understand basic php but have no javascript knowledge):</p>
  
  <pre><code>    &lt;script type="text/javascript"&gt;
  
  var field_to_update = document.getElementById('si_contact_ex_field2_3');
  field_to_update.innerHTML = '';
  
  var elOptNew = document.createElement('option');
  elOptNew.text = 'Select'
  elOptNew.value = 'Select';
  
  field_to_update.add(elOptNew);
  
  field_to_update.options[0].selected = true;
  
  var track_names = document.getElementsByName('audioFileName');  
  
  for (i=0; i&lt;track_names.length; i++) {
  
      var track_name = track_names[i].innerHTML;
  
      var elOptNew = document.createElement('option');
      elOptNew.text = track_name.replace("&amp;amp;", "&amp;");
      elOptNew.value = track_name;
  
      field_to_update.add(elOptNew); // standards compliant; doesn't work in IE
  
  }
  </code></pre>
  
  <p>What I'd like to know is: </p>
  
  <p>A) How can I reference the dropdown field in the new form (built on Contact Form 7) and utilise the above javascript so that it is populated by the ACF field (as in the previous form). At the moment I have created a "Form Tag" like this <code>[select* menu-470 "Select" "Track A" "Track B" "Track C"]</code> but obviously the <code>"Track A" "Track B" "Track C"</code> part of the tag needs to be dynamically replaced by the multiple <code>track_name</code>s inputted into the ACF field.</p>
  
  <p>B) Or if there's a better / simpler way to dynamically fill the dropdown field on the Contact Form 7 form I'd be most interested to know</p>
  
  <p>Many thanks in advance for any help with this issue.</p>
  
  <p>Phil</p>