+ Start a Discussion
Akshay ShrivastavaAkshay Shrivastava 

How to put check on submit button?

On click on submit button, I want to check that field have some value.
if the field does not have value then do not save the detail
Akshay ShrivastavaAkshay Shrivastava
There are multiple fields and  I only put check on 2 fields.
 
Dinakar92Dinakar92
If you are using a record edit form, then you can always use the "onSubmit" attribute to define your own method that will execute before submitting the form. In that method, you can validate if the fields have values or no.

https://developer.salesforce.com/docs/component-library/bundle/lightning-record-edit-form/documentation (https://developer.salesforce.com/docs/component-library/bundle/lightning-record-edit-form/documentation" target="_blank)

But, if it's a standard create/edit modal then you can use validation rules to check the field values before saving the record.