Skip to content

Commit

Permalink
fix(account-form): check manually invalidated fields on submit
Browse files Browse the repository at this point in the history
  • Loading branch information
leomp12 committed Jun 30, 2020
1 parent 2a61bd9 commit e693a42
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions @ecomplus/storefront-app/src/components/js/EcAccountForm.js
Expand Up @@ -168,16 +168,20 @@ export default {
sessionStorage.setItem(storageKey, JSON.stringify(this.localCustomer))
},

submit (ev) {
submit () {
const $form = this.$el
if ($form.checkValidity()) {
if (!this.localCustomer.display_name) {
this.localCustomer.display_name = this.localCustomer.name.given_name
if (!document.querySelectorAll('.account-form input.is-invalid').length) {
if ($form.checkValidity()) {
if (!this.localCustomer.display_name) {
this.localCustomer.display_name = this.localCustomer.name.given_name
}
this.saveToStorage()
this.$emit('update:customer', this.localCustomer)
}
this.saveToStorage()
this.$emit('update:customer', this.localCustomer)
$form.classList.add('was-validated')
} else {
$form.classList.remove('was-validated')
}
$form.classList.add('was-validated')
}
},

Expand Down

0 comments on commit e693a42

Please sign in to comment.