This commit is contained in:
2020-06-12 17:32:37 +00:00
parent 7037ca38b6
commit c81b55c000
2 changed files with 56 additions and 1 deletions

View File

@@ -827,5 +827,40 @@ export default {
listArray = []; listArray = [];
} }
listArray.unshift({ name: "-", id: 0 }); listArray.unshift({ name: "-", id: 0 });
},
////////////////////////////////////
// Get validity of referenced control
//
controlIsValid(vm, ref) {
if (vm.$refs[ref]) {
return vm.$refs[ref].valid;
}
return false;
},
////////////////////////////////////////
// All controls are valid?
//
controlsAreAllValid(vm, refs) {
//if any are not valid return false
for (let i = 0; i < refs.length; i++) {
let item = refs[i];
if (vm.$refs[item]) {
if (!vm.$refs[item].valid) {
return false;
}
}
}
return true;
// let allValid = true;
// refs.every(function gzformCheckControlsAreValid(item) {
// if (vm.$refs[item]) {
// if (!vm.$refs[item].valid) {
// allValid = false;
// return false;
// }
// }
// });
// return allValid;
} }
}; };

View File

@@ -66,8 +66,16 @@
" "
ref="requestemail" ref="requestemail"
@input="fieldValueChanged('requestemail')" @input="fieldValueChanged('requestemail')"
:hint="$ay.t('LicenseEmailVerficationHint')"
:persistent-hint="true"
></v-text-field> ></v-text-field>
</v-col> </v-col>
<v-col cols="12">
{{ sendRequestDisabled() }}
<v-btn :disabled="sendRequestDisabled()"
>$ay.t('SendRequest')</v-btn
>
</v-col>
</v-row> </v-row>
</v-expansion-panel-content> </v-expansion-panel-content>
</v-expansion-panel> </v-expansion-panel>
@@ -221,6 +229,17 @@ export default {
return "ok"; return "ok";
} }
}, },
sendRequestDisabled() {
//this is required because no rules are broken until entry starts so button is enabled
if (this.request.Company == null) {
return true;
}
return !this.form().controlsAreAllValid(this, [
"requestcompany",
"requestcontact",
"requestemail"
]);
},
translation() { translation() {
return window.$gz.translation; return window.$gz.translation;
}, },
@@ -443,7 +462,8 @@ function fetchTranslatedText(vm) {
"LicenseCompanyName", "LicenseCompanyName",
"LicenseContactName", "LicenseContactName",
"LicenseEmail", "LicenseEmail",
"RequestEvaluationLicense" "RequestEvaluationLicense",
"LicenseEmailVerficationHint"
]); ]);
} }