Google Spreadsheet的HTML输入字段

时间:2015-03-07 11:47:43

标签: javascript jquery html forms google-sheets

我觉得它几乎可以正常工作,但出于某种原因,当我尝试将数据从输入字段提交到Google电子表格时,它会添加数据,但不会添加数据。因此,在Google电子表格中,我看到一个带有时间戳的新条目,但不会显示输入的数据。

以下是代码:

<script>
$('#emailForm').one('submit',function(){
    var inputField = encodeURIComponent($('#emailForm').val());
var baseURL = 'http://docs.google.com/forms/d/1vl7imylKoya3y8bnboD7WTQ5VsdVw1YmDA1-3_66Apo/formResponse?entry.1017875735=';
var submitRef = '&submit=Submit';
var submitURL = (baseURL + emailAddress + submitRef);
$(this)[0].action=submitURL;
$('#email').addClass('active').val('Thank You!');
setTimeout(function(){
  $('#form-container').hide();
  $('#update-form').animate({'width': '0px'},300,function(){
    $('#get-updates-link').hide();
      $('#email').addClass('active').val('Thank You!');
  });
},1000); 
</script>



<form action="https://docs.google.com/forms/d/1vl7imylKoya3y8bnboD7WTQ5VsdVw1YmDA1-3_66Apo/formResponse?entry.1017875735="

<form id="emailForm" action="" method="POST" target="no-target">
  <input id="email" type="email" placeholder="enter email" name="email">
  <button id="email-submit" type="submit"></button>
</form> 

1 个答案:

答案 0 :(得分:0)

您已定义var inputField,但稍后在提交期间,您在submitURL代码行中使用了emailAddress