Visualforce developer documentation

  • View
    3.676

  • Download
    0

Embed Size (px)

DESCRIPTION

Visualforce developer documentation

Text of Visualforce developer documentation

Salesforce.com: Salesforce Spring '09

Visualforce Developer's Guide

Copyright 2000-2009 salesforce.com, inc. All rights reserved. Salesforce.com and the no software logo are registered trademarks, and AppExchange, Success On Demand, and The Business Web are trademarks of salesforce.com, inc. All other trademarks mentioned in this document are the properties of their respective owners.

Table of Contents

Table of ContentsIntroduction...............................................................................................................................6 Chapter 1: Introducing Visualforce.....................................................................................6What is Visualforce?..........................................................................................................................................7 How is Visualforce Architected?........................................................................................................................9 What are the Benefits of Visualforce?..............................................................................................................10 How Do Visualforce Pages Compare to S-Controls?......................................................................................11 Which Editions Support Visualforce?.............................................................................................................12 What's New in Spring '09?..............................................................................................................................12

Chapter 2: A Quick Start Tutorial.....................................................................................13Documentation Typographical Conventions...................................................................................................13 Common Issues Creating Visualforce Pages....................................................................................................14 Enabling Development Mode.........................................................................................................................14 Creating Your First Page..................................................................................................................................15 Displaying Field Values on a Page...................................................................................................................16 Using the Visualforce Component Library......................................................................................................18 Overriding an Existing Page with a Visualforce Page......................................................................................21 Using Input Components in a Page.................................................................................................................24 Rendering a Page as a PDF.............................................................................................................................25 Building a Table of Data in a Page...................................................................................................................27 Editing a Table of Data in a Page....................................................................................................................28 Using Query String Parameters in a Page........................................................................................................29 Using AJAX in a Page......................................................................................................................................33

Chapter 3: Page Styles...............................................................................................................37Using Salesforce Styles................................................................................................................................................37 Using Custom Styles...................................................................................................................................................38 Using Content Type....................................................................................................................................................39

Visualforce Controllers..............................................................................................................40 Chapter 4: Standard Controllers........................................................................................40Associating a Standard Controller with a Visualforce Page ............................................................................40 Accessing Data with a Standard Controller ....................................................................................................41 Using Standard Controller Actions.................................................................................................................41 Validation Rules and Standard Controllers......................................................................................................42 Styling Pages that Use Standard Controllers...................................................................................................43 Checking for Object Accessibility...................................................................................................................43 Customizing Standard Controllers .................................................................................................................44

Chapter 5: Standard List Controllers.................................................................................45Associating a Standard List Controller with a Visualforce Page......................................................................45

i

Table of Contents Accessing Data with List Controllers..............................................................................................................46 Using Standard List Controller Actions..........................................................................................................47 Pagination with a List Controller....................................................................................................................48 Using List Views with Standard List Controllers............................................................................................48 Editing Records with List Controllers.............................................................................................................50

Chapter 6: Custom Controllers and Controller Extensions.................................................52What are Custom Controllers and Controller Extensions?.............................................................................52 Building a Custom Controller.........................................................................................................................53 Building a Controller Extension......................................................................................................................55 Controller Methods.........................................................................................................................................56 Controller Class Security.................................................................................................................................58 Advanced Examples.........................................................................................................................................59 Considerations for Creating Custom Controllers and Controller Extensions.................................................72 Architecture of Custom Controllers and Controller Extensions......................................................................72 Testing Custom Controllers and Controller Extensions..................................................................................73 Validation Rules and Custom Controllers.......................................................................................................75 Using the transient Keyword...........................................................................................................................76

Chapter 7: Overriding Buttons, Links, and Tabs with Visualforce ...............................................78Example: Overriding Tabs Using a Standard List Controller......................................................................................79 Defining Custom Buttons and Links for ....................................................................................................................79 Adding Custom List Buttons using Standard List Controllers...................................................................................81

Chapter 8: Static Resources........................................................................................................83Creating a Static Resource...........................................................................................................................................83 Referencing a Static Resource in Visualforce Markup.................................................................................................83

Chapter 9: Custom Components................................................................................................85What are Custom Components?.................................................................................................................................85 Custom Component Markup......................................................................................................................................86 Using Custom Components in a Visualforce Page......................................................................................................8