May 2019
Intermediate to advanced
546 pages
12h 41m
English
When a user enters data in your Visualforce page because your form is built with the apex:inputField tag and the data will be incorrect due to custom validation rules, you can display your (error) messages in your page using the apex:(page)messages tag. In the following example, we only define the field name and a Save button. If you don't enter a name, the validation will fail and you'll receive an error on your page.
The following code is for the custom controller:
public class MyCustomController { private Movie__c movie; public PageReference save() { try{ update movie; } catch(DmlException ex){ ApexPages.addMessages(ex); } return null; } public String getName() { return 'MyController'; } public Movie__c ...Read now
Unlock full access