TransWikia.com

lightning-record-edit-form: display text field as a custom picklist?

Salesforce Asked by Michael Sobczak on October 4, 2021

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.

One Answer

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.

Answered by Murthy Tumuluri on October 4, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP