You need to sign in to do that
Don't have an account?
sai teja 69
custom Form validation with error message on below the field while using lightning-record-form in LWC?
I have designed one form using lightning record edit form and i need to perform some client side validations before submitting the from and show some errors. Is there any inbuilt functionality in LWC
Greetings to you!
To enable automatic error handling, include the component lightning-messages.To customize the behavior of your form when it loads or when data is submitted, use the onload and onsubmit attributes to specify event handlers. Errors are automatically handled. To customize the behavior of the form when it encounters an error on submission or when data is submitted successfully, use the onerror and onsuccess attributes to specify event handlers.
Please refer to the below links which might help you further with the above requirement.
https://developer.salesforce.com/docs/component-library/bundle/lightning-record-form/documentation
https://rajvakati.com/2019/02/16/lightning-record-form/
https://salesforce.stackexchange.com/questions/255367/how-to-use-lightning-record-form-onerror-to-display-custom-error-message
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas