-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathteste2.html
More file actions
54 lines (49 loc) · 2.11 KB
/
teste2.html
File metadata and controls
54 lines (49 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Form to gsheets</title>
<!--<script src="https://wzrd.in/standalone/formdata-polyfill"></script>
<script src="https://wzrd.in/standalone/promise-polyfill@latest"></script>
<script src="https://wzrd.in/standalone/whatwg-fetch@latest"></script>
-->
</head>
<body>
<h1>Link pra planilha:</h1>
<a href='https://docs.google.com/spreadsheets/d/1LSDoA22scyWVJUDlwudKqX0o86w5b-Ds-lGOhRBGYis/edit#gid=0'>iRoT gsheets</a>
<br>
<!-- https://github.com/jamiewilson/form-to-google-sheets-->
<!-- webApp url: https://script.google.com/macros/s/AKfycbxtKza8SDt27Ik39cktDyv66dD2Lt77vERuHWOVEnraLH91kQwBl1r2bPQoD8Gi1BZW/exec-->
<!--Form de envio para o google sheet-->
<form name="submit-to-google-sheet" id="gsForm">
<input name="email" type="email" placeholder="Email" required>
<input name="fname" type="text" value="Testando">
<input name="fx" type="text" id="fx" value="3487">
<input name="fy" type="hidden" value="3487">
<button onclick="func1()" type="submit">Send</button>
</form>
<!--alterar valor de um form item: -->
<!--https://www.w3schools.com/html/tryit.asp?filename=tryhtml_elem_output-->
<button type="submit" onclick="func1()" form="gsForm">Change</button>
<script>
const scriptURL = 'https://script.google.com/macros/s/AKfycbxtKza8SDt27Ik39cktDyv66dD2Lt77vERuHWOVEnraLH91kQwBl1r2bPQoD8Gi1BZW/exec'
const form = document.forms['submit-to-google-sheet']
form.addEventListener('submit', e => {
e.preventDefault()
fetch(scriptURL, { method: 'POST', body: new FormData(form)})
.then(response => console.log('Success!', response))
.catch(error => console.error('Error!', error.message))
})
</script>
<script>
//funcao que muda valor do form
function func1() {
var valor = "Outra coisa";
document.getElementById('fx').value = valor;
//alert ("Func1 executou e alterou valor x para: "+valor);
}
</script>
</body>
</html>