Title1

Title2

Title3

7. index.html

<!doctype html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  
    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
  
    <title><?= formData.webTitle ?></title>
  </head>
  <body>
    <div class="container">	
		<div id="search" class="d-none">
          <span>資料搜尋中....<img src="https://i.imgur.com/pm9SKUg.gif"></span>
        </div>
            <div id="main">
				<h1 class="text-center mb-3"><?= formData.webTitle;  ?></h1>
			
				<form action="" id="myForm" class="">
					<div class="row">
						<div class="col-sm-6">
							<div class="form-group">
								<label>學號<span class="text-danger">*</span></label>
								<input type="text" class="form-control" name="v1" id="v1" value="">
							</div>
						</div>
						<div class="col-sm-6">
							<div class="form-group">
								<label>認證碼<span class="text-danger">*</span></label>
								<input type="text" class="form-control" name="v2" id="v2" value="">
							</div>
						</div>
			
						<!--送出-->
						<div class="col-sm-12">
							<button id="submit" type="submit" class="btn btn-primary btn-block">送出</button>
						</div>
					</div>
				</form>
			</div>
	
        
    </div>
  
    <!-- Optional JavaScript -->
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>
    <style>
  .error{
    color:red;    
  }
</style>
<script src="https://cdn.jsdelivr.net/npm/jquery-validation@1.19.1/dist/jquery.validate.min.js"></script> 
 
<!-- 調用函式 -->
<script>
  $(function(){
      
    $("#myForm").validate({
      submitHandler: function(form) {
        insertDate();            
      },
      rules: {
        'v1': { required: true },
        'v2': { required: true}
      },
      messages: {
       'v1': { required: '必填'},
       'v2': { required: '必填'}  
      }
    });
     
  });
 
  function insertDate(){
    var formData = {};
    formData.v1 = document.getElementById("v1").value;
    formData.v2 = document.getElementById("v2").value;
     
      
    /*=================================
    樣板執行 函式 apps script function
    1. 表單驗證成功,執行本函式
    2. 必須在 gs建立一個「indexDataInsert(formData)」函式
    3. indexDataInsert執行完畢後,會再把結果回傳至「onSuccess(html)」
    4. 主畫面會被關閉
    5. 結果畫面會被開啟
    =================================*/
    google.script.run.withSuccessHandler(onSuccess).indexDataInsert(formData);
     
    document.getElementById('search').setAttribute("class", "");
    document.getElementById('main').setAttribute("class", "d-none");
  }
       
       
  function onSuccess(html) {
    var div = document.getElementById('search');
    div.innerHTML = html;
           
  }
 
</script>    
  </body>
</html>