+ Start a Discussion

Multiple PageBlockSections

I am VF Page to convert a spouse (in contacts) to a new contact.  I am using Multiple Page Block Sections to send information to the user based on the value of a custom field set in my custom controller.

<apex:page standardController="Contact" extensions="ConverSpouseExtension"> <apex:form > <apex:sectionheader title="Create Spouse As A New Contact"> <apex:actionregion > <apex:pageBlock title="Spouse Information" id="thePageBlock" mode="edit"> <apex:pageBlockButtons > <!-- Show Save Button if Spouse is not converted and Spouse has a First Name --> <apex:commandButton value="Convert" action="{!NContact}" rendered="{!SpouseCon.Spouse_Converted__c == 'SNCon'}" /> <apex:commandButton value="Cancel" action="{!cancel}"/> </apex:pageBlockButtons> <!-- Show if okay to Convert Spouse to a Contact --> <apex:pageBlockSection title="Spouse Ready to Convert to Contact" columns="1" rendered="{!SpouseCon.Spouse_Converted__c == 'SNCon'}"> <h1>Update information as needed and press 'Convert'</h1> </br> to convert Spouse to a Contact <apex:inputfield id="FirstName" value="{!SpouseInfo.FirstName}" /> <apex:inputfield id="LastName" value="{!SpouseInfo.LastName}" /> <apex:inputfield id="Email" value="{!SpouseInfo.Email}" /> <apex:inputfield id="Phone" value="{!SpouseInfo.Phone}" /> </apex:pageBlockSection> <!-- Show if Spouse already exists as a Contact --> <apex:pageBlockSection title="Spouse Exists as a Contact" columns="1" rendered="{!SpouseCon.Spouse_Converted__c == 'SCon'}"> <h1>A contact named {!SpouseInfo.FirstName} {!SpouseInfo.LastName} already exists</h1> </br> Press Cancel to return. </apex:pageBlockSection> <!-- Show if Spouse's First Name not entered --> <apex:pageBlockSection title="No Spouse First Name" columns="1" rendered="{!SpouseCon.Spouse_Converted__c == 'NoFName'}"> <h1>Spouse must have a First Name entered</h1></br> Press Cancel to return and add Spouse First Name. </apex:pageBlockSection> </apex:pageBlock> </apex:actionregion> </apex:sectionheader> </apex:form> </apex:page>


I have two questions:

1.  Is this the best way to do this type of 'branching'?


2.  When I do a 'Quick Save' from the Salesforce VF Page editor I get a Warning stating that,

Warning: The element type "apex:pageBlockSection" should be terminated by the matching end-tag "</apex:pageBlockSection>". at line 16 

(the bold line in the code above).  Why am I getting this warning?




Remove the sectionHeader close tag from the bottom of your page and change the open sectionheader tag to close straight after:

<apex:sectionHeader title="Create Spouse As A New Contact" />



Thanks for the response.


Everything still functions correctly with the change you suggested, but I still get the same warning from the VF Page editor when doing a Quick Save.  Any other thoughts?


I thought I was duplicating exactly the coding in the VF Developers Guide on page 82 (Creating a Wizard).




The only other thing I can see wrong with it is your br tags.  Use <br /> instead of </br>.


Apart from that it looks ok to me.

Thanks, that took care of the error!