function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SivarajanSivarajan 

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.

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