Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an overwritten edit page for my custom object, which have different record types with different fields.

The simplified desktop version of this VF page looks like this:

<apex:page standardController="CustomObject__c" extensions="CustomObjectCtrlExt" >



            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="Cancel" action="{!cancel}"/>                

            <!-- Record Type 1 -->
            <apex:pageBlockSection rendered="{!recordtypename == 'RecordTypeName1'}" >

            <!-- Record Type 2 -->
            <apex:pageBlockSection rendered="{!recordtypename == 'RecordTypeName2'}" >

            <!-- Record Type 3 -->
            <apex:pageBlockSection rendered="{!recordtypename == 'RecordTypeName3}" >




Now I want to create a second VF page for my mobile users with HTML 5.

How do I implement the conditional rendering with HTML 5 ?

Of course, something like <div rendered="{!recordtypename == Name1}"> doesn't work.

share|improve this question
up vote 5 down vote accepted
<apex:outputPanel layout="block" rendered="{!recordTypeName = 'foobar'}">
plain html here

Will render into a <div>. Experiment with different values for layout param. apex:outputText can be used in similar way but somehow I prefer the panel, feels, cleaner that way.

share|improve this answer
Isn't layout="none" a better choice? – Keith C Jul 28 '14 at 14:31
The original page has apex:form which is evil in S1 context, yadda yadda... and we don't know if the mobile version will use it or say jQuery mobile's AJAX calls. Generally I'd indeed go with "none" unless there's need for standard VF rerender to work on these. – eyescream Jul 28 '14 at 14:34
Thanks, I think that will work for me. – David Renz Jul 29 '14 at 7:06
Relating to the layout discussion, I have found a great explanation in the docs:… – David Renz Jul 29 '14 at 8:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.