2017-08-21 14 views
0

私はHTML Webアプリケーションフォームを使用していますが、フィールドは必須(必須)として選択されていますが、必須フィールドを更新せずにデータを送信できます。必須の属性がhtml webappで機能しません

以下

はあなたがonclick="submitForm()"を削除し、代わりにフォームタグでonsubmit="submitForm()"を追加する必要が懸念

<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>
<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>

+0

そのスクリプトのリンクを提供 – Ritz

+0

がhttps://docs.google.com/spreadsheets/d/1wvysoIQP_i9H66ImLL78Aa2M2auPbfPggUFU9KxbsRg/edit#gid=0 – KiKu

答えて

0

を修正するために私を助け、私の詳細なHTMLとGSスクリプトです。

<form onsubmit="return submitForm()"> 

さらに、submitForm関数にreturn false;を追加します。必要に応じて...私のために働い

+0

おかげで、それはだシートのURLをご覧ください働いて 私はインドのルピー形式の数字を得ることができます – KiKu

+0

私はここにそれを答えていると思います[リンク](https://stackoverflow.com/questions/45706820/how-to-calculate-the-total-sum- in-html-table/45708761?noredirect = 1#comment78422513_45708761)。質問を混在させない。 – Ritz

+0

送信ページが空白のページにリダイレクトされた後、どうすればこれを停止できますか? – KiKu