1

Currently, it seems that there is no way to remove some of the options for a picklist while using the lightning-input-field (in my case on the lightning-record-edit-form).

The only solution I came up with is to use the lightning-combobox instead. However, with this implementation, a custom creation of the record has to be developed which defeats the whole purpose of using the lighting form.

1 Answer 1

1

The way to still use lightning record edit forms and custom combobox field is overriding the save behaviour of form.

 <lightning-record-edit-form
        object-api-name="ObjectApiName"
        onsubmit={handleSuccess}
    >
 other lighning input field
  .......
 combobox field
</lightning-record-edit-form>

Now in js, you can override the values in form

handleSubmit(event){
   event.preventDefault();       // stop the form from submitting
   const fields = event.detail.fields;
   fields.picklistfieldapiname__c = 'some value';
   this.template.querySelector('lightning-record-edit-form').submit(fields);
}

You must log in to answer this question.

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