0

I set validation on lightning-input component as pattern and required attributes.
These validation works fine. But when blur event occurs on lightning-input, validation process is executed automatically.

I want to validate only at submitting form data via REST API.

How can I achieve this?

Sample template is simple as below.

<template>
    <div class="app slds-p-around_x-large">
        <lightning-input name="abc" label="abc" pattern="abc" required></lightning-input>
    </div>
</template>

Thanks for your reading.

0

As you don`t have access to lightning-* component internals the only way i could imagine would be to bind the respective constraints to tracked properties which are not set on initial load. When submitting your data you set them to the values you like and call the reportValidity Method on the lightning-input.

Otherwise you have to roll your own form with native inputs

| 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.