Skip to content

Commit

Permalink
Fix sendData
Browse files Browse the repository at this point in the history
  • Loading branch information
Snugug committed Jul 6, 2023
1 parent 654c2ad commit e6cf84d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions site/js/components/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,14 +302,14 @@ export class Form {
* @param {Event} event - JavaScript event.
*/
submitForm_(event) {
const formValid = this.elem_.checkValidity();
const target = event.target;
const formValid = target.checkValidity();
event.preventDefault();
const fd = new FormData(target);

this.disableFormElements_();

if (formValid) {
const fd = new FormData(this.elem_);

const country = fd.get('Country');
// Handle double-opt-in countries
// Austria, Germany, Greece, Luxembourg, Norway, Switzerland
Expand All @@ -321,7 +321,7 @@ export class Form {

const data = new URLSearchParams(fd);
this.handleLoaderVisibility_();
this.sendData_(data).bind(this);
this.sendData_.call(this, data);
} else {
this.enableFormElements_();

Expand Down

0 comments on commit e6cf84d

Please sign in to comment.