0

I am using a lightning-record-edit-form as shown below

<lightning-record-edit-form object-api-name="Client_Intake__c">
         <lightning-input-field  name="Id" field-name="Hub_Spoke_Account__c" style="width: 650px;"
              onchange={handleAccountFieldChange}>
        </lightning-input-field>
 </lightning-record-edit-form>

According to https://www.lightningdesignsystem.com/components/form-element/ , the lightning-input-field control value is supposed to be required only if we add the required attribute to it. Even though I do not have the required attribute set on the lightning-input-field , it is still being displayed as a required field. How can I fix this? enter image description here

1 Answer 1

1

You are confusing lightning-input with lightning-input-field.

lightning-input-field will follow the field's configuration (required or not based on how it was created under setup > object > field(s)) and is dependent of the record-edit-form. It uses the record-ui API to determine a number of things, including if it is required or not.

vs lightning-input which does not, as it is "standalone"

If you want to make it "not required" you will ahve to modify the field settings directly, vs adding a required attribute if you were using a lightning-input field

You must log in to answer this question.

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