2012-08-10 97 views
3

我在使用HtmlService創建的html表單中調用服務器端GAS函數提交表單時出現問題。該HtmlService文檔中說,下面應該工作:使用Google App腳本的HtmlService提交表單

<form id='myForm'> 
    <input name='myFile' type='file'> 
    <input name='aField'> 

    <input type='button' onclick='google.script.run.processForm(this.parentNode)'> 
</form> 

我使用的是類似的東西:

<form id='approveForm'> 
    <b>Enter Notes about this Approval : </b> 
    <br /><br /> 
    <textarea id = 'approvalNotes' rows='10' cols='135'>Enter notes on this approval for future reference...</textarea> 
    <br /><br /> 
    <b>Request Approved?</b> 
    <br /><br /> 
    <input name = "decision" type="radio" id = 'rApproval' value='Yes'/>Yes<br /> 
    <input name = "decision" type="radio" id = 'rApproval' value ='No'/>No<br /> 
    <input name = "decision" type= "radio" id = 'rApproval' value='Pending'/>Pending<br /> 
    <br /><br /> 
    <b>Set the Group/List Type : </b> 
    <br /><br /> 
    <input name = "gltype" type="radio" id = 'glType' value='Group'/>Group<br /> 
    <input name = "gltype" type="radio" id = 'glType' value='List'/>List<br /> 
    <input name = "gltype" type="radio" id = 'glType' value='?'/>?<br /> 
    <br /> 
    <input type='button' value='submit' onclick='google.script.run.processForm(this.parentNode)'> 
</form> 

雖然我已經做了差不多該文件說,將表單提交的工作同樣的事情,我的服務器端函數不會被調用。有人可以告訴我可能做錯了什麼,以及我可以如何解決這個問題。

+0

我剛測試你的代碼,它工作正常。只有你可能想給textarea輸入一個名字,以便解析它。嘗試添加Logger.log(JSON.stringify(form));在你的processForm函數中驗證表單是否被傳遞並且函數真的被調用。 – jad 2013-03-28 09:19:43

回答

相關問題