CSR-343 Finish validation

This commit is contained in:
Katie 2022-06-27 13:48:09 -04:00
parent f359be41c7
commit 7e4494eb25
6 changed files with 26 additions and 23 deletions

View file

@ -130,6 +130,7 @@ export default {
return this.modelValue; return this.modelValue;
}, },
set: function(newValue) { set: function(newValue) {
console.log(newValue)
this.$emit("update:modelValue", newValue); this.$emit("update:modelValue", newValue);
} }
}, },
@ -143,15 +144,20 @@ export default {
return answer.Name ? answer.Name : answer; return answer.Name ? answer.Name : answer;
}, },
handleCheckedChanged(val) { handleCheckedChanged(val) {
console.log(val)
console.log("A")
if(this.selectingInitiatesLoad) { if(this.selectingInitiatesLoad) {
console.log("B")
this.selectedValues = [val.value]; this.selectedValues = [val.value];
} else { } else {
if(Array.isArray(this.selectedValues)) { if(Array.isArray(this.selectedValues)) {
console.log("C")
const newSelectedValues = this.selectedValues; const newSelectedValues = this.selectedValues;
val.checkValue ? newSelectedValues.push(val.value) : newSelectedValues.splice(newSelectedValues.indexOf(val.value), 1); val.checkValue ? newSelectedValues.push(val.value) : newSelectedValues.splice(newSelectedValues.indexOf(val.value), 1);
this.selectedValues = newSelectedValues; this.selectedValues = newSelectedValues;
} }
else { else {
console.log("D")
this.selectedValues = val.value; this.selectedValues = val.value;
} }
} }

View file

@ -85,6 +85,7 @@ export default {
}; };
}, },
buttonClick() { buttonClick() {
console.log("HI")
//prevent keyboard input after button click //prevent keyboard input after button click
document.onkeydown = function (e) { document.onkeydown = function (e) {
return false; return false;

View file

@ -4,11 +4,6 @@
<p class="mb-0 color-question-text">{{ colorQuestionText }}</p> <p class="mb-0 color-question-text">{{ colorQuestionText }}</p>
</div> </div>
</div> </div>
{{ featureListData }}
<br />
{{ tintSelectionOptions }}
<br />
{{ selectedTint }}
{{ selectedPart }} {{ selectedPart }}
<div class="container nested-radio"> <div class="container nested-radio">
@ -34,6 +29,7 @@
class="radioQuestion" class="radioQuestion"
:questionText="glassFeatureQuestion" :questionText="glassFeatureQuestion"
:answers="featureListData[selectedTint]" :answers="featureListData[selectedTint]"
:selectedValues="selectedPart"
textPosition="text-start" textPosition="text-start"
:loaderEnabled="false" :loaderEnabled="false"
isRequired isRequired
@ -123,7 +119,7 @@ export default {
return this.modelValue; return this.modelValue;
}, },
set: function (newValue) { set: function (newValue) {
console.log("modelValue: " + newValue) console.log(newValue)
this.$emit("update:modelValue", newValue); this.$emit("update:modelValue", newValue);
}, },
}, },

View file

@ -27,7 +27,7 @@
<div class="container-fluid"> <div class="container-fluid">
<hr v-if="i > 0" /> <hr v-if="i > 0" />
</div> </div>
{{ glassParts }}
<glassPartQuestion <glassPartQuestion
:ref="`${RefPrefix}-${item.glassLocation}-${item.glassName}`" :ref="`${RefPrefix}-${item.glassLocation}-${item.glassName}`"
v-model="glassParts[item.glassLocation + '-' + item.glassName]" v-model="glassParts[item.glassLocation + '-' + item.glassName]"
@ -112,7 +112,6 @@ components: {
}, },
computed: { computed: {
isForwardActionDisabled() { isForwardActionDisabled() {
console.log(this.glassParts)
return !this.glassParts || Object.values(this.glassParts).filter(value => value).length === 0; return !this.glassParts || Object.values(this.glassParts).filter(value => value).length === 0;
}, },
PartsForQuestions() { PartsForQuestions() {

View file

@ -46,6 +46,7 @@ html {
input[type=radio]+label:before, input[type=radio]+label:before,
input[type=checkbox]+label:before { input[type=checkbox]+label:before {
border: 1px solid $red; border: 1px solid $red;
background-color: initial;
} }
input[type=checkbox]:checked + label:before { input[type=checkbox]:checked + label:before {
border: 1px solid $blue; border: 1px solid $blue;

View file

@ -1,18 +1,19 @@
<template> <template>
<!-- Checkbox groups MUST be wrapped in a <fieldset> and <legend> tag and must contain tabindex --> <!-- Checkbox groups MUST be wrapped in a <fieldset> and <legend> tag and must contain tabindex -->
<div class="ui-radio form-check" :class="[hasError ? 'has-error' : '']"> <div class="ui-radio form-check" :class="[(errors.length > 0 || hasError) ? 'has-error' : '']">
<input <input
type="radio" type="radio"
class="form-check-input" class="form-check-input"
aria-checked="false" aria-checked="false"
:name="groupName" :name="groupName"
:id="buttonID" :id="buttonID"
:aria-required="isRequired" :aria-required="isRequired"
:value="value" :value="value"
:v-model="checkValue" :v-model="checkValue"
@change="handleCheckChange()" @change="handleCheckChange"
:checked="checkValue" :checked="checkValue"
/> :validationRules="validationRules"
/>
<label class="d-flex align-items-start form-check-label" :for="buttonID"> <label class="d-flex align-items-start form-check-label" :for="buttonID">
<p v-if="buttonLabel" class="m-0">{{ buttonLabel }}</p> <p v-if="buttonLabel" class="m-0">{{ buttonLabel }}</p>
<span v-if="screenReaderOnlyText" class="sr-only">{{ <span v-if="screenReaderOnlyText" class="sr-only">{{
@ -39,6 +40,7 @@ export default {
screenReaderOnlyText: String, screenReaderOnlyText: String,
selectedValues: [Array, String], selectedValues: [Array, String],
hasError: Boolean, hasError: Boolean,
validationRules: String
}, },
data() { data() {
return { return {
@ -53,10 +55,8 @@ export default {
} }
}, },
methods: { methods: {
handleClick(value) {
this.handleChange(value);
},
handleCheckChange() { handleCheckChange() {
this.handleChange(this.value);
const emitEvent = { const emitEvent = {
checkValue: this.checkValue, checkValue: this.checkValue,
value: this.value.toString(), value: this.value.toString(),