title: Return web form values to Google app script
body: <p>I have a google sheets script that allows the user to enter certain data. I want to be able to pass these values back to a function in the google app script when the user clicks OK.</p>
  
  <p>Here is the Google sheet script I am trying to get to work. The function checkLogin does get called until I try to pass the values to it from the web page.</p>
  
  <p>The gscript</p>
  
  <pre><code>function onOpen() {
     openLogin();
     SpreadsheetApp.getUi()
        .createMenu('Dialog')
        .addItem('Open', 'openLogin')
        .addToUi()
  }
  
  function openLogin() {
      var html = HtmlService.createHtmlOutputFromFile('index');
      SpreadsheetApp.getUi() 
        .showModalDialog(html, 'Login Form');
  }
  
  function checkLogin(user_name, user_password, staff, student) {
      SpreadsheetApp.getUi().alert(user_name); 
  }
  </code></pre>
  
  <p>and the web page code is as follows:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
     &lt;base target="_top"&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;form&gt;    
      First name:&amp;nbsp;&amp;nbsp;
      &lt;input type="text" name="user_name"&gt;&lt;br&gt;&lt;br&gt;
      Last name:&amp;nbsp;&amp;nbsp;
      &lt;input type="password" name="user_password"&gt;&lt;br&gt;&lt;br&gt;
      Staff or Student?
      &lt;br&gt;
  
      &lt;input type="radio" name="staff" value="staff" checked&gt; Staff&lt;br&gt;
      &lt;input type="radio" name="student" value="student"&gt; Student&lt;br&gt;
      &lt;br&gt;&lt;br&gt;
  
      &lt;input type="button" value="OK"
      onclick="google.script.run.checkLogin(user_name, user_password, staff, student)" /&gt;
  
      &lt;input type="button" value="Close"
      onclick="google.script.host.close()" /&gt;
  
    &lt;/form&gt;
  
   &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I hope someone can point me in the right direction. Thanks</p>