I have a lightning-record-edit-form
with multiple lightning-input-field
.
I'd like to put some of the input-field
into a child component, say childComponent
. The code is attached at the end.
However, the issue is that the lightning-input-field
in childComponent
does not render correctly. I assume the connection between lightning-record-edit-form
and the API name in field-name
are broken.
How to fix it?
The code for parent component:
field3__c
and field4__c
do not show correctly.
<template>
<lightning-record-edit-form object-api-name={objectApiName} record-id={recordId}>
<lightning-input-field field-name="field1__c"></lightning-input-field>
<lightning-input-field field-name="field2__c"></lightning-input-field>
<c-child-component></c-child-component>
</lightning-record-edit-form
</template>
The code for child component:
<template>
<lightning-input-field field-name="field3__c"></lightning-input-field>
<lightning-input-field field-name="field4__c"></lightning-input-field>
</template>