1

I'm working in LWC form which has lightning-input and lightning-input-address.

In lightning-input when the value is missing, displaying the error message by using message-when-value-missing.

The same when i Used for lightning-input-address, It's not working and It's still shows Complete this field. error Message.

    <lightning-input label="Phone" value={familyPhone} onchange={handleChange}
                                            name="familyPhone" message-when-value-missing=" " required>
                                        </lightning-input>

<lightning-input-address address-label="Address" street-label="Street"
                                            city-label="City" country-label="Country" province-label="State"
                                            postal-code-label="PostalCode" street={billingStreetval}
                                            city={billingCityval} country={billingCountryval} province={billingStateval}
                                            postal-code={billingPostalval} onchange={handlefamilyChange} message-when-value-missing="Address is Mandatory"
                                            required>
                                        </lightning-input-address>

Expecting Like Below, When the Value is empty we need to Highlight the input address field like below. Thanks in Advance.

enter image description here

1 Answer 1

2

lightning-input-address does not support message-when-value-missing. https://developer.salesforce.com/docs/component-library/bundle/lightning-input-address/specification

You can use setCustomValidityForField instead

enter image description here

lightning-input supports it. https://developer.salesforce.com/docs/component-library/bundle/lightning:input/specification

1

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.