I have an LWC with a piece that goes something like:
Javascript
handlePCCFieldChange(event) {
if (event.target.name === "checkbox") {
this.Obj.checkbox = event.target.checked;
console.log('checkbox');
}
if (event.target.name === "text") {
this.Obj.text = event.target.value;
console.log('text');
}
}
HTML
<div>
<lightning-input data-id="data-checkbox" type="checkbox" name="checkbox" onclick={handleFieldChange}></lightning-input><br>
<lightning-input data-id="data-text" type="text" name="text" onclick={handleFieldChange}></lightning-input><br>
I do need to log the values on change for some conditional changes and state saving. However, I have some 20 or so fields that I need to save and this feels like a very inflated way of solving a rather simple task. Can someone help me find a better way to do this? I'm at a loss.