0

I'm trying to reset form field values after submitting a form with lightning-record-edit-form but haven't been able to reset the rich text field.

The HTML is this:

<lightning-layout-item padding="horizontal-small">
    <!-- review comment field code using commentField -->
    <div class="slds-form-element">
        <lightning-input-field
            field-name={commentField}>
        </lightning-input-field
    </div>
</lightning-layout-item>

The handleReset function

handleReset() {
    const inputFields = this.template.querySelectorAll(
        'lightning-input-field'
    );
    if (inputFields) {
        inputFields.forEach(field => {
            field.reset();
            if (field == 'lightning-input-rich-text') {
                field.setRangeText("", 0, input.value.length, "start")
            }
        });
    }
 }

The lightning-input-rich-text is within the lightning-input-field but not able to select it with setting a class and call queryselector or with the condition I set in the controller code.

1 Answer 1

0

As per the documentation here: https://developer.salesforce.com/docs/component-library/bundle/lightning-input-rich-text/documentation

you need to query lightning-input-rich-text:

this.template.querySelector('lightning-input-rich-text')

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .