Skip to content

Commit

Permalink
Merge pull request #689 from mpourismaiel/fix/contact/formspree-async…
Browse files Browse the repository at this point in the history
…-issue

Fix formspree not working when asking for captcha
  • Loading branch information
stp-ip authored Jan 22, 2020
2 parents 0b03818 + 5084f3c commit 429a736
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion assets/js/contact.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const validatorConfig = {
$(`form[id=${form.getAttribute('id')}] .generic-error`).removeClass('d-none');
},
onSuccess: function(e, form) {
if (form.dataset.hasNetlify) {
if (form.dataset.hasNetlify || form.dataset.hasFormspree) {
return;
}

Expand Down
4 changes: 2 additions & 2 deletions assets/js/helpers/jq-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ $.ajax = function ajax({
xhr.onreadystatechange = () => {
if (xhr.readyState == 4) {
if (xhr.status == 200) {
resolve(JSON.parse(xhr.responseXML || xhr.responseText));
resolve(JSON.parse(xhr.responseXML || xhr.responseText));
} else {
reject(xhr.statusText);
reject(xhr.statusText);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion assets/scripts/syna-contact.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions layouts/partials/fragments/contact.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
{{- safeHTMLAttr (print " data-has-netlify=\"true\" netlify") -}}
{{- else -}}
{{- safeHTMLAttr (printf " action=\"%s\"" (.Params.post_url | default (printf "https://formspree.io/%s" .Params.email))) -}}
{{- end -}}
{{- if and (isset .Params "email") -}}
{{- safeHTMLAttr (print " data-has-formspree=\"true\"") -}}
{{- end }}>
<div class="row py-3 should-fade">
<div class="col-md-6">
Expand Down

0 comments on commit 429a736

Please sign in to comment.