Skip to content

Instantly share code, notes, and snippets.

@arun12209
Created January 21, 2023 07:47
Embed
What would you like to do?
import { LightningElement, track, wire } from 'lwc';
import validateData from '@salesforce/apex/ValidationController.validateData';
export default class MyComponent extends LightningElement {
@track name;
@track email;
@track age;
@track errors = [];
handleSubmit() {
validateData({ name: this.name, email: this.email, age: this.age })
.then(result => {
if (result.errors.length > 0) {
this.errors = result.errors;
} else {
// proceed with next step in process
}
})
.catch(error => {
console.error(error);
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment