Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

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:form>

        <apex:pageBlock>         

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

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


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


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



            ...



    </apex:form>

</apex:page>

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

1 Answer 1

up vote 4 down vote accepted
<apex:outputPanel layout="block" rendered="{!recordTypeName = 'foobar'}">
plain html here
</apex:outputPanel>

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 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 at 14:34
    
Thanks, I think that will work for me. –  David Renz Jul 29 at 7:06
    
Relating to the layout discussion, I have found a great explanation in the docs: salesforce.com/us/developer/docs/pages/Content/… –  David Renz Jul 29 at 8:22

Your Answer

 
discard

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.