Remove restriction on programmatically setting lightning-input-fields - Ideas - Salesforce Trailblazer Community
Trailblazer Community

All Ideas

Idea Details

Post an Idea
750  Points
Idea has been posted. Give it an upvote or downvote.

Remove restriction on programmatically setting lightning-input-fields

Developer Tools

The lighting-input-field documentation states the following:

"If a user enters anything in an input field, you can no longer programmatically set the value of the field. The assumption is that there are unsaved changes that should not be overwritten. If you want to be able to overwrite user changes, you can use lightning-input instead."

Here is some simple code that, unituitively, does not work due to this limitation. It is working with a new record.
  1. Click the button and see the lightning-input-field get updated.
  2. Manually type something into the lightning-input-field and see it change.
  3. Go back and click the button and see the update no longer work.
                field-name="Name" value={name}></lightning-input-field>

    <lightning-button label="Click to change name" variant="brand" onclick={handleClick}></lightning-button>
import { LightningElement, track } from 'lwc';

export default class Example extends LightningElement {
    @track name = 'a';

    handleClick() { = + 'a';
(gist link)

Why wouldn't it also be assumed that user input collected from a lightning-input is also an unsaved change that should not be overwritten programmaticaly? It seems totally arbitrary to limit lightning-input-field.

The lightning-input-field is more desireable, in many cases, since it is metadata aware and can easily handle things such as locales.

The restriction of not being able to programmatically set lightning-input-fields after user input should be removed.

Merge Idea · Flag

  • Upvotes
  • Downvotes



from AppExchange


No results found.

Help us to keep IdeaExchange clean by pointing out overlapping ideas. We'll investigate your suggestion and merge the ideas if it makes sense.



Thanks for your merge suggestion. We will review it shortly and merge the ideas if applicable.

Salesforce takes abuse situations very seriously. Examples of abuse include but are not limited to posting of offensive language or fraudulent statements. To help us process your request as quickly as possible, please fill out the form below describing the situation. For privacy and security reasons, the final outcome of an abuse case may not be revealed to the person who reported it.


Thank you for your feedback. We take abuse seriously and will investigate this issue and take appropriate action.