This commit is contained in:
@@ -365,6 +365,38 @@ export default {
|
||||
return err;
|
||||
},
|
||||
///////////////////////////////
|
||||
// EMAIL IS VALID-ish
|
||||
//https://tylermcginnis.com/validate-email-address-javascript/
|
||||
emailValid(vm, ref) {
|
||||
if (vm.formState.loading) {
|
||||
return true;
|
||||
}
|
||||
let ctrl = getControl(vm, ref);
|
||||
if (typeof ctrl == "undefined") {
|
||||
return true;
|
||||
}
|
||||
|
||||
//DEBUG
|
||||
//logControl("emailValid", ctrl, ref);
|
||||
|
||||
let value = getControlValue(ctrl);
|
||||
if (isEmpty(value)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value) == true) {
|
||||
return true;
|
||||
}
|
||||
|
||||
let err = vm.$ay.t("ErrorAPI2203"); //"Invalid value"
|
||||
//Update the form status
|
||||
this.setFormState({
|
||||
vm: vm,
|
||||
valid: false
|
||||
});
|
||||
return err;
|
||||
},
|
||||
///////////////////////////////
|
||||
// USER REQUIRED FIELDS
|
||||
// (Fields defined by AyaNova users as required on form that are not stock required already)
|
||||
// (was using this in testing on widget form notes field but not sure where else it's applicable)
|
||||
|
||||
@@ -57,7 +57,10 @@
|
||||
v-model="request.Email"
|
||||
:label="$ay.t('LicenseEmail')"
|
||||
type="email"
|
||||
:rules="[form().required(this, 'requestemail')]"
|
||||
:rules="[
|
||||
form().required(this, 'requestemail'),
|
||||
form().emailValid(this, 'requestemail')
|
||||
]"
|
||||
:error-messages="
|
||||
form().serverErrors(this, 'requestemail')
|
||||
"
|
||||
|
||||
Reference in New Issue
Block a user