Salesforce Certified Platform Developer II — Question 239

A developer created a Lightning web component that uses a lightning-record-edit-form to collect information about Leads. Users complain that they only see one error message at a time about their input when trying to save a Lead record.

What is the recommended approach to perform validations on more than one field, and display multiple error messages simultaneously with minimal JavaScript intervention?

Answer options

Correct answer: A

Explanation

The correct answer is A, as an external JavaScript library can facilitate the validation of multiple fields at once, allowing for the display of several error messages simultaneously. Options B (Apex trigger) and C (Validation rules) do not provide a user interface for immediate feedback on the form, and D (Try/catch/finally block) is used for error handling in JavaScript, not for form validation.