WIP update validation for phone.

This commit is contained in:
Bryan Mauger 2023-05-17 08:36:40 -04:00
parent ca05c03fc5
commit eb70fda412

View file

@ -22,12 +22,15 @@
</template>
<script>
import { useField, validate } from "vee-validate";
export default {
name: "phoneNumberQuestion",
props: {
cmsWidgetName: String,
isRequired: Boolean,
validationRules: String,
hasError: Boolean,
centerErrorMessage: Boolean,
},
setup(props) {
const inputId = !props.customInputId ? `input-${crypto.randomUUID()}` : props.customInputId;
@ -50,6 +53,22 @@ export default {
value: modelValue,
initialValue: initialValue,
};
const { errorMessage, handleBlur, handleChange, meta, validate, errors } = useField(
inputId,
props.validationRules,
fieldOptions
);
return {
inputId,
errorMessage,
handleBlur,
handleChange,
validate,
meta,
errors,
};
},
data() {
return {