The <apex:pageMessages> component displays all information, warning or error messages that were generated for all components on the current page. In the previous form, the account name was a required field. To ensure that a standard error message is displayed if someone tries to submit the form without supplying an account name, do the following:
- Update your page by inserting the following line after the <apex:pageBlock> tag:
<apex:pageMessages/>
- Now click Save on the form. An error panel will be displayed:
Visualforce’s standard controllers contain methods that make it easy to save and update records. By using the <apex:form> and <apex:inputField> components, you can easily bind input fields to new records using the standard controllers. The user interface automatically produces input components that match the type of the field—for example displaying a calendar input for a Data type field. The <apex:pageMessages> component can be used to group and display the information, warning and error messages across all components in the page.Learning More
- You can use the <apex:commandLink> instead of the <apex:commandButton> component within a form to provide a link for form processing.
- Use the quicksave() method instead of the save() method to insert or update an existing record without redirecting the user to the new record.
- Use the <apex:pageBlockButtons> component to place command buttons when using the <apex:pageBlock> component.
- Use the <apex:pageMessage> component (the singular, not the plural) to create custom messages.
No comments:
Post a Comment