+ Start a Discussion

Custom validation on Lightning-record-edit-form

Hi Folks,

i use lightning-edit-form in my lighting web component. Would like to validate some backend logic based on the customer inputs entered in the edit form using apex class method.  How to validate the logic and show lightning error message before clicking save button.

i tried to show the sample error  message for testing on the event of submit or onclick of the lightning-record-edit-form.

how to check the logic and through the error before save the record.

Mateusz OtrebaMateusz Otreba
Hi Sivarjan, here is an example which explain how you can validate your data https://salesforceprofs.com/custom-validation-with-lightningrecordeditform/