Custom Submit Button for a lightning:recordEditForm

Sharing is Caring

The lightning:recordEditForm allows us to create a custom looking form that can interact with Salesforce records, or create new Salesforce records. The lightning:recordEditForm uses the Lightning Data Service so we can potentially avoid needing to create an Apex controller to create/update/delete the data meaning it handles all of the field-level security and sharing for us!

Often we’ll have a requirement to do some sort of custom submit button because we need to validate something or do an additional process before the submit occurs.

Our Component file (“.cmp”) would look something like this:

Our controller might look something like this:

Note that we need to manually submit the form by finding the form and calling the submit method.

Sharing is Caring

Brian is a software architect and technology leader living in Niagara Falls with 13+ years of development experience. He is passionate about automation, business process re-engineering, and building a better tomorrow.

Brian is a proud father of four: two boys, and two girls and has been happily married to Crystal for more than ten years. From time to time, Brian may post about his faith, his family, and definitely about technology.