Level 1
Anyone can help me with my issue. Thank you.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
When i add a new dynamic select and i chose the same option that was already in the selects array Example: { id: '1', name: 'Contact Info > Provide Email Address', value: '0.05' }, i get the default option that was { id: '0', name: 'Please Select an action', value: '0' },
changeOption(selectId, newOptionId) {
console.log('Change Option: selectId', selectId, 'newOptionId', newOptionId);
const selectIndex = this.selects.findIndex((select) => select.id === selectId);
setTimeout(() => {
const selectedOption = this.options.find((option) => option.id === newOptionId);
if (selectedOption && selectIndex !== -1) {
const updatedSelect = {
id: selectId,
name: selectedOption.name,
value: selectedOption.value,
};
// Update both arrays
this.selects[selectIndex] = updatedSelect;
const actionIndex = this.selectedActions.findIndex((action) => action.id === selectId);
if (actionIndex !== -1) {
this.selectedActions[actionIndex] = updatedSelect;
} else {
this.selectedActions.push(updatedSelect);
}
this.selects = [...this.selects];
this.selectedActions = [...this.selectedActions];
}
console.log('Action changed', this.selects);
}, 0);
},
Please or to participate in this conversation.