Skip to content
Snippets Groups Projects
Commit c73d9bc4 authored by Timothee P's avatar Timothee P :sunflower:
Browse files

prevent undefined field, appeared while browsing features

parent ff78a16f
No related branches found
No related tags found
1 merge request!515REDMINE_ISSUE-15534| Amélioration du parcours de signalements - Activer le parcours de signalements sur tous les clics sur un signalement + affichage du tri et du filtre courants
......@@ -354,24 +354,26 @@ export default {
},
created() {
const { field_type, options, value } = this.field;
if (field_type === 'pre_recorded_list') {
this.loadingPrerecordedListValues = true;
this.GET_SELECTED_PRERECORDED_LIST_VALUES({
name: options[0],
pattern: ''
})
.then(() => {
this.loadingPrerecordedListValues = false;
if (this.field) {
const { field_type, options, value } = this.field;
if (field_type === 'pre_recorded_list') {
this.loadingPrerecordedListValues = true;
this.GET_SELECTED_PRERECORDED_LIST_VALUES({
name: options[0],
pattern: ''
})
.catch(() => {
this.loadingPrerecordedListValues = false;
});
if (value) {
this.selectedPrerecordedValue = { label: value };
.then(() => {
this.loadingPrerecordedListValues = false;
})
.catch(() => {
this.loadingPrerecordedListValues = false;
});
if (value) {
this.selectedPrerecordedValue = { label: value };
}
} else if (field_type === 'multi_choices_list' && value) {
this.selectedMultipleCheckbox = value;
}
} else if (field_type === 'multi_choices_list' && value) {
this.selectedMultipleCheckbox = value;
}
},
......@@ -384,20 +386,22 @@ export default {
]),
updateStore_extra_form(evt) {
const newExtraForm = this.field;
if (this.field.field_type === 'boolean') {
newExtraForm['value'] = evt.target.checked; //* if checkbox use "checked"
} else if (this.field.field_type === 'multi_choices_list') {
newExtraForm['value'] = this.selectedMultipleCheckbox;
} else {
newExtraForm['value'] = evt.target.value;
if (this.field) {
const newExtraForm = this.field;
if (this.field.field_type === 'boolean') {
newExtraForm['value'] = evt.target.checked; //* if checkbox use "checked"
} else if (this.field.field_type === 'multi_choices_list') {
newExtraForm['value'] = this.selectedMultipleCheckbox;
} else {
newExtraForm['value'] = evt.target.value;
}
this.$store.commit('feature/UPDATE_EXTRA_FORM', newExtraForm);
}
this.$store.commit('feature/UPDATE_EXTRA_FORM', newExtraForm);
},
checkForm() {
let isValid = true;
if (this.field.is_mandatory && !this.field.value) {
if (this.field && this.field.is_mandatory && !this.field.value) {
isValid = false;
this.error = 'Ce champ est obligatoire';
} else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment