You need to sign in to do that
Don't have an account?
Andrew Aldis 15
Scroll to the top of the page if there is an error
I created a lighting component to create a record using the <lightning:recordEditForm> component and a standard submit button. It works well but it displays any error messages on the top of the screen. I am looking for a way to check if there is an error message and if there is I would like to scroll back to the top of the page for review. Does anyone have any ideas?
Did you use <lightning:messages /> ?
https://developer.salesforce.com/docs/component-library/bundle/lightning:recordEditForm/documentation
When there is an error, the event onerror is triggered but the scrolling with some JS code is not standard in the lex components.
The standard alternative could be a simple toast using the errorCode and message of the event onerror.
Event: onerror error Object The error data returned by the form submission.
onerror="{!c.handleError}"
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/js_validate_fields.htm
Did you get any answer? I am looking for same problem too..