+ Start a Discussion
Carl_V1Carl_V1 

nesting VF components inside an if..then statement

Question -

Is it possible to nest VF components inside an IF..THEN statement that uses record level criteria to determine true or false?

Example -

Code:
if (account.recordtype = 'type1') {
     <apex:page> version 1 of your custom VF page </apex:page>
} else {
     <apex:page> version 2 of your custom VF page </apex:page>
}

If it is, I cant find the syntax to be able to get it right. Any advice most appreciated.




Message Edited by Carl_V1 on 10-09-2008 04:48 PM
jwetzlerjwetzler
no.  the page component must always be the first thing on your page.

look into the action attribute on page, which will run when your page loads, allowing you to redirect the user to a different page based on a condition.  There are plenty of examples and questions about it on the forums.

You can also use the rendered attribute to show/hide various parts of your page.