3

I've created a custom object where the user manually enters a locale value (ex: en_US, es). Instead of letting the user manually enter a locale, I'd like to provide the user with a combo box of valid options to select from. (The options would be a subset of the supported languages selected in the org, retrieved via Apex.) In Visualforce, there was a way to accomplish this by overriding the default page layout and supplying your own custom VF page, which would include a <apex:selectList> for a given text field, and the select options retrieved via Apex.

Is it possible to do the same thing with <lightning-record-edit-form>, where an <lightning-input-field> can be defined as picklist values supplied via a wired lookup? Or can a include a <lightning-combobox>? I was hoping there would be an easy way to accomplish what I need in LWC without having to recreate the entire record layout from scratch.

2
  • 1
    Out of curiosity, is there anything preventing you from changing the field type to an unrestricted picklist and then using the native functionality of picklist labels & values?
    – Mark Pond
    Jul 14, 2020 at 19:37
  • 1
    @MarkPond The pick list values and labels need to be dynamically retrieved. They are a subset of the org's selected languages. I also don't want the user to just type in anything, since they could easily mistype a location code. Jul 14, 2020 at 19:48

1 Answer 1

0

You will have to use lightning-combobox instead of lightning-input-field and populate the options and values from either Apex or from JS using RecordUI.

1

You must log in to answer this question.

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