Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

Commit

Permalink
fix: change contact form submission link
Browse files Browse the repository at this point in the history
  • Loading branch information
ratheesk committed Jan 20, 2024
1 parent 1783a8f commit 4000d21
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 58 deletions.
28 changes: 28 additions & 0 deletions assets/js/google_form.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
!function(exports) {
exports.submitGoogleForm = submitGoogleForm;

function submitGoogleForm(form) {
try {
var data = [].slice.call(form).map(function(control) {
return 'value' in control && control.name ?
control.name + '=' + (control.value === undefined ? '' : control.value) :
'';
}).join('&');
var xhr = new XMLHttpRequest();

xhr.open('POST', form.action + '/formResponse', true);
xhr.setRequestHeader('Accept',
'application/xml, text/xml, */*; q=0.01');
xhr.setRequestHeader('Content-type',
'application/x-www-form-urlencoded; charset=UTF-8');
xhr.send(data);
} catch(e) {}

form.parentNode.className += ' submitted';


return false;
}
}(typeof module === 'undefined' ? window : module.exports);


17 changes: 11 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -241,17 +241,20 @@ <h2>Have you any question?</h2>
to collaborate. Together, let's make a difference in empowering women in STEAM.</p>
</div>
<div id="form_status"></div>
<!-- https://docs.google.com/forms/d/1z8epCnhgSqcS7-qQDz0jggQEGP5t4Jof7pruIPW0W9I/edit -->
<div class="contact-form">
<form type="POST" id="dow-contact" onSubmit="return valid_datas( this );" action="mail.php">
<form method="post" id="dow-contact" role="form" onSubmit="window.submitGoogleForm(this);"
action="https://docs.google.com/forms/d/1z8epCnhgSqcS7-qQDz0jggQEGP5t4Jof7pruIPW0W9I/formResponse">
<p>
<input type="text" placeholder="Name" name="name" id="name">
<input type="email" placeholder="Email" name="email" id="email">
<input type="text" placeholder="Name" name="entry.842494675" id="name">
<input type="email" placeholder="Email" name="entry.1838818462" id="email">
</p>
<p>
<input type="tel" placeholder="Phone" name="phone" id="phone">
<input type="text" placeholder="Subject" name="subject" id="subject">
<input type="tel" placeholder="Phone" name="entry.2035665660" id="phone">
<input type="text" placeholder="Subject" name="entry.1469256439" id="subject">
</p>
<p><textarea name="entry.1308286529" id="message" cols="30" rows="10" placeholder="Message"></textarea>
</p>
<p><textarea name="message" id="message" cols="30" rows="10" placeholder="Message"></textarea></p>
<input type="hidden" name="token" value="FsWga4&@f6aw" />
<p><input type="submit" value="Submit"></p>
</form>
Expand Down Expand Up @@ -321,6 +324,8 @@ <h4><i class="fas fa-address-book"></i> Contact</h4>
<script src="assets/js/sticker.js"></script>
<!-- main js -->
<script src="assets/js/main.js"></script>
<!-- Google form JS -->
<script src="./assets/js/google_form.js"></script>
</body>

</html>
52 changes: 0 additions & 52 deletions mail.php

This file was deleted.

0 comments on commit 4000d21

Please sign in to comment.