Custom Submit Button for a lightning:recordEditForm

Salesforce Lightning
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