@@ -16,7 +16,6 @@ export function getStaticPaths() {
16
16
const { lang } = Astro .params ;
17
17
const contact = await getListPage (" contact" , lang as keyof ContentEntryMap );
18
18
19
- const { contact_form_action }: { contact_form_action: string } = config .params ;
20
19
const { title, description, meta_title, image } = contact [0 ].data ;
21
20
22
21
const {
@@ -39,18 +38,24 @@ const {
39
38
<div class =" container" >
40
39
<div class =" row" >
41
40
<div class =" mx-auto md:col-10 lg:col-6" >
42
- <form action ={ contact_form_action } method =" POST" >
41
+ <form
42
+ action =" https://docs.google.com/forms/d/e/1FAIpQLSdKLON3GrQN1OrGxmj0S3HCKeiVg-MjmeqDHLufys7CzkDm1g/formResponse"
43
+ method =" POST"
44
+ target =" _blank"
45
+ onsubmit =" return window .submitGoogleForm (this );"
46
+ >
43
47
<div class =" mb-6" >
44
48
<label for =" name" class =" form-label" >
45
49
{ full_name }
46
50
<span class =" text-red-500" >*</span >
47
51
</label >
48
52
<input
49
53
id =" name"
50
- name =" name "
54
+ name =" entry.713430944 "
51
55
class =" form-input"
52
56
placeholder =" Krishna Chaitanya Ethamukkala"
53
57
type =" text"
58
+ required
54
59
/>
55
60
</div >
56
61
<div class =" mb-6" >
@@ -60,10 +65,11 @@ const {
60
65
</label >
61
66
<input
62
67
id =" email"
63
- name =" email "
68
+ name =" entry.1244225098 "
64
69
class =" form-input"
65
70
66
71
type =" email"
72
+ required
67
73
/>
68
74
</div >
69
75
<div class =" mb-6" >
@@ -73,13 +79,38 @@ const {
73
79
</label >
74
80
<textarea
75
81
id =" message"
76
- name =" message "
82
+ name =" entry.618640668 "
77
83
class =" form-input"
78
84
placeholder ={ contact_message_placeholder }
79
- rows =" 8" ></textarea >
85
+ rows =" 8"
86
+ required
87
+ ></textarea >
88
+ </div >
89
+ <div id =" form-status" class =" mb-6 hidden" >
90
+ <p class =" text-success" >Thank you for your message! We'll get back to you soon.</p >
80
91
</div >
81
92
<button type =" submit" class =" btn btn-primary" >{ submit } </button >
82
93
</form >
94
+
95
+ <script is:inline >
96
+ window.submitGoogleForm = function(form) {
97
+ const formData = new FormData(form);
98
+ fetch(form.action, {
99
+ method: 'POST',
100
+ body: formData,
101
+ mode: 'no-cors'
102
+ })
103
+ .then(() => {
104
+ form.reset();
105
+ document.getElementById('form-status').classList.remove('hidden');
106
+ setTimeout(() => {
107
+ document.getElementById('form-status').classList.add('hidden');
108
+ }, 5000);
109
+ })
110
+ .catch(error => console.error('Error:', error));
111
+ return false;
112
+ };
113
+ </script >
83
114
</div >
84
115
</div >
85
116
</div >
0 commit comments