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

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.