WIP update validation for phone.
This commit is contained in:
parent
ca05c03fc5
commit
eb70fda412
1 changed files with 19 additions and 0 deletions
|
|
@ -22,12 +22,15 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { useField, validate } from "vee-validate";
|
||||||
export default {
|
export default {
|
||||||
name: "phoneNumberQuestion",
|
name: "phoneNumberQuestion",
|
||||||
props: {
|
props: {
|
||||||
cmsWidgetName: String,
|
cmsWidgetName: String,
|
||||||
isRequired: Boolean,
|
isRequired: Boolean,
|
||||||
validationRules: String,
|
validationRules: String,
|
||||||
|
hasError: Boolean,
|
||||||
|
centerErrorMessage: Boolean,
|
||||||
},
|
},
|
||||||
setup(props) {
|
setup(props) {
|
||||||
const inputId = !props.customInputId ? `input-${crypto.randomUUID()}` : props.customInputId;
|
const inputId = !props.customInputId ? `input-${crypto.randomUUID()}` : props.customInputId;
|
||||||
|
|
@ -50,6 +53,22 @@ export default {
|
||||||
value: modelValue,
|
value: modelValue,
|
||||||
initialValue: initialValue,
|
initialValue: initialValue,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const { errorMessage, handleBlur, handleChange, meta, validate, errors } = useField(
|
||||||
|
inputId,
|
||||||
|
props.validationRules,
|
||||||
|
fieldOptions
|
||||||
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
|
inputId,
|
||||||
|
errorMessage,
|
||||||
|
handleBlur,
|
||||||
|
handleChange,
|
||||||
|
validate,
|
||||||
|
meta,
|
||||||
|
errors,
|
||||||
|
};
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue