Visualforce Webinar S8 FAQ


Image:header_multimedia.gif

Webinar FAQ: Mastering Visualforce - Move Beyond S-Controls

This is the FAQ for the Mastering Visualforce - Move Beyond S-Controls webinar.

Contents



Does the apex for Visualforce pages require test methods like apex triggers?

Yes, all apex regardless of how it is used requires test coverage for deployment to production or upload to the AppExchange.

Is there a way to iterate through a list of objects on a single page and maintain inline editing?

The standard inline editing feature is not available in Visualforce.

Is the content in the Visualforce page searchable from the home page?

Text that is stored within a Visualforce page is not searchable from our standard search functionality.

How do I start practicing this? Is there a set of tutorials or a course?

Check out the Visualforce page on developer.force.com, which has plenty of screencasts, tutorials and articles. Also be sure to check out the Visualforce Documentation. A training curriculum is being established now. Stay tuned to developer.force.com for a schedule of courses.


How would Visualforce handle an HTML page with 6 columns? When making a Salesforce look and feel interface, are you still limited to 2 columns?

Visualforce pages are not bound/restricted by those you will find in standard salesforce.com pages. With respect to column numbers within our standard pageBlockSection component you can provide any number you wish. If you do not like the formatting you can also drop to coding whatever HTML/CSS you feel appropriate for your page as well.

Could I build a page in Visualforce with a variable number of lines, where each line consists of 5 input fields? Then, upon submit, each line gets inserted (or updated) in as an individual record?

Yes, you can even have a mechanism to add lines to the page dynamically if you so choose.


Can the code interact with two or multiple models (instances that contain different data)

Yes you can if you interact with the model from a custom controller or from an extension to a standard controller. You can embed your own SOQL queries within these Apex classes to retrieve whatever data you require.

Is it still possible to add JavaScript to Visualforce pages? In S-Controls one can always use innerHTML to dynamicaly generate HTML. Is there an equivalent in VisualForce?

Visualforce supports JavaScript so this technique could still be used if desired. I would suggest getting acquainted with custom components and other Visualforce ways of generating dynamic/interactive content to avoid browser compatibility issues and maintenance going forward. For example, see the rerender tag.

As a consultant, I am frequently asked to add additional behavior to an edit page (not the detail page). Inline S-Controls won't serve this puspose as they only appear on detail pages. While I realize I could create a Visualforce and add all of the necessary components, how would I handle multiple record types and page layouts? Using the <apex:detail> component will not work, I don't think, as the enhancements need to appear WITHIN the edit area as if they were added on the page layout. Long question I know, sorry

There is no way to leverage page layout information from within an edit experience but you can control which fields are visible/required and further which components are visible (sections/tables/etc) based on whatever your rules are. To do that you would need a standard controller extension (a type of apex controller) that can inspect the current user's profile and the record type of the record to do whatever it is your edit experience requires.

Can JavaScript be embedded in VisualForce methods?

Actions in Visualforce pages are bound to methods in the page's controller. The method itself does not support or directly interact with JavaScript. However, there are event hooks on each of the action components that allow JavaScript to be incorporated into the invocation within the page.

Is there a reason to using Eclipse for writing Visualforce or would you recommend using the online developer mode editor? Also, can this editor be used to develop Apex triggers and classes? It looks awesome!

Thanks, I like it too :) The editor we use for Visualforce is available under setup for pages, components and Apex class and triggers. Eclipse is a great development tool as well and has specific capabilities for deploying code and also supports many additional types. For editing pages and code the choice is yours. Whichever makes you most productive is the right one for you.


Since we can create visualforce pages in Production environments, are there any plans to let us create and modify controllers (classes) in production orgs as well?

No. The decision to allow development of pages in production was based on the separation of presentation and logic. Controllers are code and need to follow our deployment process.


Can you do something like: on click of the button a row has to be added as well as on click of button row has to be deleted. Based upon the values in the column the colour of the row must be changed. That is, a dynamic editable table?

While a bit more of an advanced topic, this behavior can be created with Visualforce. Generically the solution would require a specific model - not unlike the history model (collection) that was demonstrated with the casehistory example which provides the information needed to control the row's styling.

Does <apex:inputfield> support a master-detail relationship? I have tried and it simply outputs the name instead of giving a lookup icon

Yes, the lookup icon should appear this is standard behaviour


Should we do our development via eclipse and push the code changes through projects?

I often use Eclipse on pages over 20 lines of markup, or where i am copying from one org to another.

So Visualforce + AJAX Toolkit is a "no-no"? it's sub-optimal, and should not be needed Do I have to fully understand how to write Apex code to use Visualforce?

You do not need to fully understand Apex, but it will help as you build complex pages and create pages with business logic


how do you expose the page editor? user prefreference developer mode

You need to enable developer mode. Go to Setup/My Personal Information/Personal Information and then click Edit. Select the Development Mode checkbox, then hit Save.

Since Professional edition does not offer full functionality for integrations, however, Visualforce is available. Can you describe the differences between what I can do in Visualforce with Professional versus Enterprise?

With Professional edition you cannot create custom logic for your pages, you must build pages with only standard controllers.


What is the future for page layouts now that VisualForce is here?

Page layouts are here to stay, they will allow customization where standard look and feel is sufficent


Will you be rewriting any s-controls written by Salesforce, such as Quote Line Items?

Sure, but this will take a few months as Visualforce is not yet packagable.


Is it possible to just edit a section / custom field on the existing Account Detail page or do I have to re-design the complete page using Visual Force? Is Visual force capable of editing the certain sections of the existing page?

It is possible to put Visualforce in place of a field on a page, however it is not possible to take over a section and leave the rest of the page as a standard page.


Is it really free? Anything for advanced developers?

Yes, it is free for developers and included in your subscription for users


How do you Inline within Page Layout with VisualForce?

There are two ways to do this:

  1. If you create a VF page that has, say standardController="Acount', then you will be able to select 'Pages' as a 'field' to add in your Accounts page layout edit pages. Just drop it anywhere as you would with a normal field. You will have access the account's fields from within your VF page.
  2. Create an S-Control of type 'URL' and point it to your VF page (can be any page, even with custom controllers) and include that S-Control in your page layout.

One of the last few slides mentioned using VisualForce on new/edit screens - can you do this to inject new UI into standard object (e.g. Account, Contact) new/edit screens?

No, you must create the edit page your self in Visualforce


Are we able to edit visualforce code written by others once it's imported into our SF instance?

Yes, provided it is not part of a package, which it is not today, and you have proper permissions on your profile.