+ Start a Discussion
Stefaan Somers 12Stefaan Somers 12 

lightning-record-form values not updated

Hi,

Im' using in lwc the following code : 
<lightning-record-form object-api-name={objectApiName} record-id={recordId} fields={fields} onsuccess= {handleSuccess} ></lightning-record-form>

After I went into edit, changed a value and saved the changes, I go back to the page where the record-form is in read-mode. But unfortunateley it doesn't contain the changed value. I need to refresh the whole page, to see the changes
Pavan WaghmodePavan Waghmode
Hello

Can you please provide your js file code here. I also faced same problem in one lwc implementation. So I added called my default method in connectedCallback 
Stefaan Somers 12Stefaan Somers 12
Hi,

this is my JS code
/**
 * Created by stefaans on 11/09/2019.
 */

import { LightningElement, api } from 'lwc';

export default class Candidateprofile extends LightningElement {
    @api recordId;
    @api objectApiName;
    fields = ['Memo_VIV__c', 'Attention_VIV__c','Parttime_hours__c','Movement_in_km_VIV__c', 'Salary_expectation_VIV__c', 'Functionlabels_employee__c', 'Functionlabels_labourer__c','CV_Text__c',  'Ref_intern__c'];


    handleSuccess(event){
        console.log('handleSuccess');
        const payload = event.detail;
        console.log(JSON.stringify(payload));
        this.refreshValues();
    }

    refreshValues() {
    console.log('refreshing values');
    const inputFields = this.template.querySelectorAll('lightning-input-field');
    if (inputFields) {
        inputFields.forEach((field) => {
            field.reset();
        });
    }
}

}