title: Prefill Google Forms with current date by manipulating p refill url string
body: <p>Hello  I have research many ways on how to prefill google form with a current date in the date input field.<br>
  The best i came up with is to create a prefill form and use the prefill google form url and dynamically change the url string to insert current date as one of the arguments.
  I tried creating a page(google app script)  with a link reference that i am trying to set the link href to the new string containing current date argument but no success. I already have a function(in code.gs) that take the google form url and manipulates it correctly to input the current date in the url string as one of the arguments. But setting this new url string in the link href  not working.  </p>
  
  <p>Can you advise(examples be great) on this or an easier way to prefill current date on a google form.
  Most most appreciated.  </p>
  
  <pre><code>/* NOTE!!! Make a copy of this file - Choose "File" "Make a copy..."
   * Then publish this as a Web App - 
   * To Publish Choose the menu item "Publish" then "Deploy as Web App"
   * to see the Web App click the link named - "Test web app for your latest code"
   *
   */
  
  var EXAMPLE_OF_GLOBAL_VARIABLE;//Use all capital letters so that you know it is a global
  var n3;
  function doGet() {
  var template = HtmlService.createTemplateFromFile('Index');
  
  
  // Build and return HTML in IFRAME sandbox mode.
  return template.evaluate()
    .setTitle('Web App Window Title')
   .setSandboxMode(HtmlService.SandboxMode.IFRAME);
    };
  
    //Attribute - This code is modified from the Google Help for a web app
      //Help - Welcome Screen - Web App
   function getFolderContents() {
   var contents,file,files,folderId,numFiles,topFolder;
  
   folderId = 'root'; //Set this as the default for an example
   topFolder;
   contents = {
    children: []
    };
  
   if (folderId == 'root') {
  topFolder = DriveApp.getRootFolder();
  } else {
  // May throw exception if the folderId is invalid or app
  // doesn't have permission to access.
  topFolder = DriveApp.getFolderById(folderId);
  }
  contents.rootName = topFolder.getName() + '/';
  
   files = topFolder.getFiles();
   numFiles = 0;
  
  while (files.hasNext() &amp;&amp; numFiles &lt; 20) {
  file = files.next();
  contents.children.push(file.getName());
  numFiles++;
  };
  
  return contents; 
   };
  function getnowx() {
  var today = new Date();
   var dd = today.getDate();
   var mm = today.getMonth()+1; //January is 0!
   var yyyy = today.getFullYear();
  
  if(dd&lt;10) {
        dd = '0'+dd
        } ;
      if(mm&lt;10) {
        mm = '0'+mm
        }; 
     today = yyyy + '-' + mm + '-' + dd;
    var n ='https://docs.google.com/forms/d/e/1FAIpQLSd5By6kDoO_T4WZWk5VjKs6WD5RVuC_06RX7jDv19jS-KR8sg/viewform?usp=pp_url&amp;entry.1374707830=xxxx-xx-xx&amp;entry.406706983&amp;entry.1232084117&amp;entry.769389513&amp;entry.104847992';
       var n1 = n.replace("xxxx-xx-xx",today);  
        return n1;
         };
  </code></pre>
  
  <p>my javascript section</p>
  
  <pre><code> &lt;script&gt;
       function updateDisplay(contents) {
       var headingText = "Displaying contents for " + contents.rootName + " 
      folder:";
       document.getElementById('main-heading').textContent = headingText;
       for (var i = 0; i &lt; contents.children.length; i++) {
       var name = contents.children[i];
    document.getElementById('results').insertAdjacentHTML('beforeend', '&lt;div&gt;' 
    + name + '&lt;/div&gt;');
  
     }
  
    function updateDisplay2(n5) {
  
     var linkButton = document.getElementById("link-button");
     linkButton.setAttribute('href', n5); 
     document.getElementById('link-button').textContent = linkText;
     }
  
    window.getTheData = function() {
    google.script.run
     .withSuccessHandler(updateDisplay)
    .getFolderContents();
  
      };
  
    window.getnowx2 = function() {
    google.script.run
    .withSuccessHandler(updateDisplay2)
    .getnowx();
    }
     &lt;/script&gt;
  </code></pre>