I have a radio button and a text box on the UI. Based upon the selection in radio button field, I show/hide the text box(s) as shown below:
onChangeUpdateAffectedFields = Custom event to show/hide text box
params: field object which has field specific properties (id, name, inputType, value, visibility etc.)
formData: List of all the fields as pair
<template>
<div>
<FormComponent :schema="this.getSchemaFor('Myfieds')" v-model="formData"
@onChangeUpdateAffectedFields ="onChangeUpdateAffectedFields"
/>
</div>
</template>
methods: {
onChangeUpdateAffectedFields: function(params) {
params.field.affectedField.forEach(element => {
const seq = parseInt(params.field.id.split("_")[1]);
var fld = <Find my field logic>;
fld.visibility = <set the visibility based upon field's properties>;
this.$set(this.formData,params.field.id, params.fieldValueNew);
//Reset value - This code is not working
this.$set(this.formData, fld.id, "");
});
}
}
The value on this text box component remains the same even after this.$set(this.formData,fld.id, ""). Is there any other way of resetting?
v-modelinto target input control?