Merge branch 'develop' into feature/kroell/INSR-8105
This commit is contained in:
commit
d8068f43f6
3 changed files with 21 additions and 4 deletions
|
|
@ -92,6 +92,10 @@ export default {
|
||||||
buttonMain
|
buttonMain
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
alwaysEmitFieldErrorOnClick: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
type: {
|
type: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'text'
|
default: 'text'
|
||||||
|
|
@ -136,7 +140,7 @@ export default {
|
||||||
default: () => {}
|
default: () => {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
emits: ['focus', 'update:modelValue', 'textboxQuestionEvent.inputIdAssigned', 'click-event'],
|
emits: ['focus', 'update:modelValue', 'textboxQuestionEvent.inputIdAssigned', 'click-event', 'field-has-error'],
|
||||||
setup(props) {
|
setup(props) {
|
||||||
const propsClone = { ...props };
|
const propsClone = { ...props };
|
||||||
const { modelValue } = propsClone;
|
const { modelValue } = propsClone;
|
||||||
|
|
@ -254,6 +258,8 @@ export default {
|
||||||
if (result.valid) {
|
if (result.valid) {
|
||||||
this.handleChange(this.value);
|
this.handleChange(this.value);
|
||||||
this.$emit('click-event');
|
this.$emit('click-event');
|
||||||
|
} else if (this.alwaysEmitFieldErrorOnClick) {
|
||||||
|
this.$emit('field-has-error', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
<textboxQuestion
|
<textboxQuestion
|
||||||
ref="zipInputTextQuestion"
|
ref="zipInputTextQuestion"
|
||||||
v-model="internalZipcode"
|
v-model="internalZipcode"
|
||||||
|
:alwaysEmitFieldErrorOnClick="true"
|
||||||
:cmsWidgetName="cmsWidgetName"
|
:cmsWidgetName="cmsWidgetName"
|
||||||
inputId="serviceZipCode"
|
inputId="serviceZipCode"
|
||||||
cornerStyle="rounded"
|
cornerStyle="rounded"
|
||||||
|
|
@ -9,7 +10,8 @@
|
||||||
isRequired
|
isRequired
|
||||||
:hasError="hasError"
|
:hasError="hasError"
|
||||||
:validationRules="`zip-required|${cmsWidgetName}-zip-format`"
|
:validationRules="`zip-required|${cmsWidgetName}-zip-format`"
|
||||||
@clickEvent="updateModelValue" />
|
@clickEvent="updateModelValue"
|
||||||
|
@fieldHasError="handleFieldError" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
@ -41,7 +43,7 @@ export default {
|
||||||
default: false
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
emits: ['update:modelValue'],
|
emits: ['update:modelValue', 'field-has-error'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
internalZipcode: this.modelValue
|
internalZipcode: this.modelValue
|
||||||
|
|
@ -58,6 +60,9 @@ export default {
|
||||||
defineRule(`${this.cmsWidgetName}-zip-format`, regex(/^\d{5}$/, this.serviceZipFormatErrorMessage));
|
defineRule(`${this.cmsWidgetName}-zip-format`, regex(/^\d{5}$/, this.serviceZipFormatErrorMessage));
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
handleFieldError(hasError) {
|
||||||
|
this.$emit('field-has-error', hasError);
|
||||||
|
},
|
||||||
updateModelValue() {
|
updateModelValue() {
|
||||||
this.$emit('update:modelValue', this.internalZipcode);
|
this.$emit('update:modelValue', this.internalZipcode);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,8 @@
|
||||||
:ref="SERVICE_ZIP_QUESTION_REF_NAME"
|
:ref="SERVICE_ZIP_QUESTION_REF_NAME"
|
||||||
v-model="internalZipcode"
|
v-model="internalZipcode"
|
||||||
customInputId="serviceZipCode"
|
customInputId="serviceZipCode"
|
||||||
:cmsWidgetName="textboxQuestionWidgetName" />
|
:cmsWidgetName="textboxQuestionWidgetName"
|
||||||
|
@fieldHasError="handleFieldError" />
|
||||||
<div
|
<div
|
||||||
v-if="errorMessage"
|
v-if="errorMessage"
|
||||||
ref="errorMessageDiv"
|
ref="errorMessageDiv"
|
||||||
|
|
@ -327,6 +328,11 @@ export default {
|
||||||
}
|
}
|
||||||
return addressLine2;
|
return addressLine2;
|
||||||
},
|
},
|
||||||
|
handleFieldError(hasChildFormFieldError) {
|
||||||
|
if (hasChildFormFieldError) {
|
||||||
|
this.errorMessage = '';
|
||||||
|
}
|
||||||
|
},
|
||||||
forceServiceZipRerender() {
|
forceServiceZipRerender() {
|
||||||
this.renderServiceZip = false;
|
this.renderServiceZip = false;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue