回答編集履歴

2

.withSuccessHandler(informCompletion)

2022/10/25 14:01

投稿

Cocode
Cocode

スコア2314

test CHANGED
@@ -32,8 +32,8 @@
32
32
  <h1>出退勤管理</h1>
33
33
 
34
34
  <label for="employee-id">社員ID</label><input type="text" id="employee-id" required>
35
- <input type="button" id="in" value="出勤">
35
+ <input type="button" value="出勤">
36
- <input type="button" id="out" value="退勤">
36
+ <input type="button" value="退勤">
37
37
 
38
38
 
39
39
  <script>
@@ -63,10 +63,13 @@
63
63
 
64
64
  // 確認で「OK」なら、
65
65
  // GASのwriteDate()関数を実行(引数:社員ID、出勤or退勤)
66
+ // それが成功したらinformCompletion()関数を実行
66
- google.script.run.writeData(employeeId, status);
67
+ google.script.run.withSuccessHandler(informCompletion).writeData(employeeId, status);
68
+ }
67
69
 
70
+ function informCompletion() {
68
71
  // 打刻完了のお知らせポップアップ
69
- alert('打刻しました。');
72
+ alert('打刻を完了しました。');
70
73
  }
71
74
  </script>
72
75
  </body>

1

fix

2022/10/25 13:49

投稿

Cocode
Cocode

スコア2314

test CHANGED
@@ -26,7 +26,6 @@
26
26
 
27
27
  <head>
28
28
  <base target="_top">
29
- <!-- <?!= HtmlService.createHtmlOutputFromFile('style').getContent(); ?> -->
30
29
  </head>
31
30
 
32
31
  <body>
@@ -64,7 +63,7 @@
64
63
 
65
64
  // 確認で「OK」なら、
66
65
  // GASのwriteDate()関数を実行(引数:社員ID、出勤or退勤)
67
- google.script.run.withSuccessHandler(response).writeData(employeeId, status);
66
+ google.script.run.writeData(employeeId, status);
68
67
 
69
68
  // 打刻完了のお知らせポップアップ
70
69
  alert('打刻しました。');