Avoiding validation errors with action regions

Submitting a Visualforce form without populating a required field causes an error message to be returned to the user. When the user has triggered the submission by clicking on a button, a message of this nature will not come as a surprise. If the submission is automatically triggered, for example, to retrieve fields once a lookup is populated, the sudden and unexpected appearance of an error message is a poor user experience.

In this recipe, we will create a Visualforce page to create an opportunity with a number of required fields. When the user selects the account to associate the opportunity with, the form will be submitted and related fields from the account record will be populated regardless ...

Get Visualforce Development Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.