2015-01-28 3 views
0

HTML 파일로 채워진 Google SideBar가 있습니다. 버튼을 누르면 Form에서 Google Apps 스크립트로 여러 값을 전달하여 Google 시트로 전달하기 전에 데이터를 처리하는 버튼이 있습니다.내 양식의 값이 Google 코드로 전달되지 않는 이유는 무엇입니까?

모든 1 일을 제외하고 잘 작동 :

나는 다른 모든 측면과 함께 값을 전달하지 않습니다 만든 슬라이드 바.

이유를 설명 할 수 있습니까?

나는 많은 양의 코드를 가지고 있으므로 필요한 내용을 잘라내야 만합니다.

HTML :

<form id="form1"> 
<br> 
    <table width="100%"> 
    <tr> 
     <td><p>Action Description: </p></td> 
     <td colspan="3"> <textarea id="description" name="description" rows="15" cols="22" required> </textarea> </td> 
    </tr> 
    <tr> 
     <td><p>Current Completion Percentage: </p></td> 
     <td> 
     <input type="range" min="0" max="100" value="0" id="percent" step="10" onchange="outputUpdate(value)" list="perstep"> 
     <datalist id="perstep"> 
      <option>0</option> 
      <option>10</option> 
      <option>20</option> 
      <option>30</option> 
      <option>40</option> 
      <option>50</option> 
      <option>60</option> 
      <option>70</option> 
      <option>80</option> 
      <option>90</option> 
      <option>1000</option> 
     </datalist> 
     </td> 
     <td> 
     <p><output for="form1" id="level">0</output>%</p> 
     </td> 
    </tr> 
    <tr> 
     <td><p>Assigned To: </p></td> 
     <td colspan="3"> <input id="assignedto" name="assignedto" type="text" required /> </td> 
    </tr> 
    <tr> 
     <td><p>Action Number: </p></td> 
     <td colspan="3"> <input id="actionnum" name="actionnum" type="number" /> </td> 
    </tr> 
    </table> 
    <br> 
    <hr> 

    <table width="100%"> 
    <tr> 
     <td align="center" colspan="3" height="40"> 
     <input id="date" name="date" type="date" required /> 
     <br> 
     </td> 
    </tr> 
    <tr> 
     <td> 
     <input onclick="formSubmit()" type="button" value="Submit" /> 
     </td> 
     <td> 
     <input onclick="google.script.host.close()" type="button" value="Close" /><br> 
     </td> 
     <td> 
     <input onclick="clearAll()" type="button" value="Clear All" name="clear" /><br> 
     </td> 
    </tr> 
    </table> 
</form> 

구글 .gs 코드 :

function getValuesFromForm(form1){ 
    var ss = SpreadsheetApp.getActiveSpreadsheet(), 
     sheet = ss.getSheetByName('Action Plan'), 
     sheet2 = ss.getSheetByName('Problem Details'), 
     description = form1.description, 
     percent = form1.percent, 
     assignedto = form1.assignedto, 
     actionnum = form1.actionnum, 
     date = form1.date, 
     oldNum = sheet2.getRange(11, 1).getValue(), 
     today1 = Utilities.formatDate(new Date(),"GMT","dd/MM/yyyy"), 
     lastCol = sheet.getLastColumn(), 
     lastRow = sheet.getLastRow(), 
     datecheck = sheet.getRange(1,lastCol).getValue(); 

    if(description == "" || assignedto == "" || date == ""){ 
    SpreadsheetApp.getUi().alert('Please ensure you have completed the minimal required fields'); 
    } else {   
    if(datecheck == Utilities.formatDate(new Date(),"GMT","dd/MM/yyyy")) { 
     sheet.appendRow([oldNum +1, description, percent + " %", assignedto,date]); 
     sheet.getRange(lastRow +1,lastCol).setValue("New Action"); 
     var head = sheet.getRange(1,1,1,lastCol); 
     head.setBackground("#b4a7d6"); 
     head.setFontColor("white"); 
     head.setFontWeight("bold"); 
     head.setFontSize(12); 
     sheet2.getRange(11, 1).setValue(oldNum + 1); 
    } else { 
     sheet.getRange(1,lastCol + 1).setValue(today1); 
     sheet.appendRow([oldNum +1, description, percent + " %", assignedto,date]); 
     sheet.getRange(lastRow +1,lastCol +1).setValue("New Action"); 
     var head = sheet.getRange(1,1,1,lastCol + 1); 
     head.setBackground("#b4a7d6"); 
     head.setFontColor("white"); 
     head.setFontWeight("bold"); 
     head.setFontSize(12); 
     sheet2.getRange(11, 1).setValue(oldNum + 1); 
    } 
    } 
} 

나는 순간에 얻을 모든 "지정"입니다.

도움이 될 것입니다.

답변

1

슬라이드 막대를 만드는 요소 <input type="range" min="0" max="100" value="0" id="percent" step="10" onchange="outputUpdate(value)" list="perstep">에는 name 특성이 없으므로 제출 된 데이터에 아무런 기여도 제공하지 않습니다. 따라서 적절한 값으로 name 속성을 추가하십시오.

+0

나는 그렇게 간단한 것을 놓친 것을 믿을 수 없다! - 고맙습니다! – Petay87

관련 문제