强制属性在html webapp中不起作用

时间:2017-08-21 11:02:08

标签: google-apps-script

我正在使用HTML webapp表单并且字段被选为必填字段(必填)但我能够在不更新必填字段的情况下提交数据。

下面是我详细的HTML和gs脚本,帮助我解决问题



 <script>
        function submitForm(btnClicked) {
            $("button").attr("disabled", true);
            var jsonObj = {};
            jsonObj["Project Name"] = $("#ProjectName").val();
             jsonObj["updateBtn"] = $(btnClicked).text();
            google.script.run.withSuccessHandler(afterSaving).saveDate(jsonObj);
        }
        
                function afterSaving() {
            alert("Thanks, Your response has been recorded");
            $("button").attr("disabled", false);
        }
    </script>
&#13;
<form action="" method="get">
<div class="container"> 
 <table class="table table-bordered" width="" style="width:54%">
    <thead>
    
      <tr class="one">
        <th width="33%">
Project Name

</th>
       
       
      </tr>
    </thead>
    <tbody>
      <tr>
        
        <td><div class="form-group txt">
<input  name="" type="text" placeholder="" class="form-control input-md" id="ProjectName" required="required">
</div></td>
       
      </tr>
      
    </tbody>
  </table>
  </div>
  
  <div class="container">
<div class="col-md-2 col-md-offset-5">
<div class="form-group">
    <button style="display:block;width:100%" id="updateBtn" name="singlebutton" class="btn btn-success" type="submit" onclick="submitForm()" >Save</button>
</div>

</div>
</div>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

您需要删除reject,然后在表单标记中添加Error

SELECT MAX(CAST (valeur AS INT)), MIN(CAST (valeur AS INT)) 
FROM liste_caracteristiques as L 
WHERE idCarac = '1'

另外,将func handlePing(writer http.ResponseWriter, request *http.Request) { timestr := time.Now() writer.Write([]byte(timestr.Format(time.RFC3339Nano))) } 添加到submitForm函数。