+ Start a Discussion
ckellieckellie 

Dynamic Editing - Change 1 columns to two columns

I am working on a visualforce pagethat allows the user to choose two different contacts, verify the contact information, and then enter in the correct information. I have set up the page in two columns, until the dynamic editing sections. How do I put one section in one column and the second dynamic editing set of fields in the second column? Here is my code for the page:

 

<apex:page standardController="Manufacturing_Design_Sheet__c" recordSetVar="{!Manufacturing_Design_Sheet__c}" showHeader="true" sidebar="true" extensions="TechContactTrigger">
 <apex:form >
     <apex:pageBlock Title="Manufacturing Design Sheet - Optyx G6 3000" mode="edit" id="thePageBlock">
                <apex:pageBlockButtons location="top">
                <apex:commandButton value="Update" action="{!save}" rerender="tech" />
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="Cancel" action="{!Delete}"/>
            </apex:pageBlockButtons>
       <apex:pageBlockSection columns="2">
        <apex:inputfield value="{!Manufacturing_Design_Sheet__c.Name}"/>
        <apex:inputfield value="{!Manufacturing_Design_Sheet__c.Opportunity_Name__c}" required="false"/>
        <apex:inputfield value="{!Manufacturing_Design_Sheet__c.Quotation_Item_Number__c}" required="false"/>
        <apex:inputfield value="{!Manufacturing_Design_Sheet__c.Account_Name__c}"/>
        </apex:pageBlockSection>
    <apex:PageBlockSection title="Contact Information (All Required)" columns="2">
        <apex:inputfield value="{!Manufacturing_Design_Sheet__c.Technical_Contact__c}"/>
        <apex:inputfield value="{!Manufacturing_Design_Sheet__c.Commercial_Contact__c}"/>
        <apex:outputfield value="{!Manufacturing_Design_Sheet__c.Technical_Phone__c}" />
        <apex:outputfield value="{!Manufacturing_Design_Sheet__c.Commercial_Phone__c}" />     
        <apex:outputfield value="{!Manufacturing_Design_Sheet__c.Technical_Fax__c}" />
        <apex:outputfield value="{!Manufacturing_Design_Sheet__c.Commercial_Fax__c}" /> 
        <apex:outputfield value="{!Manufacturing_Design_Sheet__c.Technical_E_mail__c}" />
        <apex:outputfield value="{!Manufacturing_Design_Sheet__c.Commercial_E_mail__c}" />
        <apex:outputfield value="{!Manufacturing_Design_Sheet__c.Ship_To_Address__c}"/>
        <apex:outputfield value="{!Manufacturing_Design_Sheet__c.Invoice_To_Address__c}"/>
    </apex:pageBlockSection>

       <apex:actionRegion >
       <apex:pageblockSection >
      
       <apex:pageBlockSectionItem >
       <apex:outputLabel value="Ship To Information Correct?"/>
                       
                        <apex:outputPanel >
                        <apex:inputfield value="{!Manufacturing_Design_Sheet__c.ShipTo_Information_Correct__c}">
                       
                        <apex:actionSupport event="onchange" rerender="ShipToAddress"
                                                    status="status"/>
        </apex:inputField>
                            <apex:actionStatus startText="applying value..." id="status"/>

       </apex:outputPanel>
       </apex:pageBlockSectionItem>
       </apex:pageblockSection>
       </apex:actionRegion>
       <apex:pageBlockSection id="ShipToAddress" columns="1">
           <apex:pageBlockSection columns="1" rendered="{!Manufacturing_Design_Sheet__c.ShipTo_Information_Correct__c =='No'}">
           <apex:inputfield value="{!Manufacturing_Design_Sheet__c.Technical_Phone_Amended__c}" />
           <apex:inputfield value="{!Manufacturing_Design_Sheet__c.Technical_Fax_Amended__c}" />
           <apex:inputfield value="{!Manufacturing_Design_Sheet__c.Technical_E_mail_Amended__c}" />          
           <apex:inputField value="{!Manufacturing_Design_Sheet__c.Ship_To_Street__c}"/>
           <apex:inputField value="{!Manufacturing_Design_Sheet__c.Ship_To_City__c}"/>      
           <apex:inputField value="{!Manufacturing_Design_Sheet__c.Ship_To_State__c}"/>
           <apex:inputField value="{!Manufacturing_Design_Sheet__c.Ship_To_Zip_Postal_Code__c}"/>  
           <apex:inputField value="{!Manufacturing_Design_Sheet__c.Ship_To_Country__c}"/>
      </apex:pageBlockSection></apex:pageBlockSection>
       <apex:actionRegion >
       <apex:pageblockSection >
      
       <apex:pageBlockSectionItem >
       <apex:outputLabel value="Invoice To Information Correct?"/>
                       
                        <apex:outputPanel >
                        <apex:inputfield value="{!Manufacturing_Design_Sheet__c.Invoice_To_Address_Correct__c}">
                       
                        <apex:actionSupport event="onchange" rerender="InvoiceToAddress"
                                                    status="status"/>
        </apex:inputField>
                            <apex:actionStatus startText="applying value..." id="status"/>

       </apex:outputPanel>
       </apex:pageBlockSectionItem>
       </apex:pageblockSection>
       </apex:actionRegion>
       <apex:pageBlockSection id="InvoiceToAddress" columns="1">
           <apex:pageBlockSection columns="1" rendered="{!Manufacturing_Design_Sheet__c.Invoice_To_Address_Correct__c =='No'}">
       <apex:inputfield value="{!Manufacturing_Design_Sheet__c.Commercial_Phone_Amended__c}" /> 
       <apex:inputfield value="{!Manufacturing_Design_Sheet__c.Commercial_Fax_Amended__c}" />
       <apex:inputfield value="{!Manufacturing_Design_Sheet__c.Commercial_E_mail_Amended__c}" />      
       <apex:inputField value="{!Manufacturing_Design_Sheet__c.Invoice_To_Street__c}"/>
       <apex:inputField value="{!Manufacturing_Design_Sheet__c.Invoice_To_City__c}"/>
       <apex:inputField value="{!Manufacturing_Design_Sheet__c.Invoice_To_State__c}"/>
       <apex:inputField value="{!Manufacturing_Design_Sheet__c.Invoice_To_Zip_Postal_Code__c}"/>  
       <apex:inputField value="{!Manufacturing_Design_Sheet__c.Invoice_To_Country__c}"/>
      </apex:pageBlockSection></apex:pageBlockSection>     
    </apex:pageBlock>
     </apex:form>
</apex:page>

 

 

Thank you

Best Answer chosen by Admin (Salesforce Developers) 
CTU007CTU007

Yes, I can use panelgrid to show columns I wanted with my own heading.

 

 

All Answers

CTU007CTU007

Hi, I noticed you used two actionRegion in your code. Do they work?

 

I am trying to do two dynamic editing in one page, but it gives me error.

 

Part of my code is:

<apex:panelGrid columns="3" columnClasses="left,right" width="100%" border="1" > <apex:outputText value="a" style="font-weight:bold" /> <apex:outputText value="did the perception change? if so, how did it change?" /> <apex:actionRegion> <apex:outputPanel id="perception" > <apex:inputField value="{!Opportunity_Competitive_Analysis__c.perception_changed__c}" > <apex:actionSupport event="onchange" rerender="pereption" status="status"/> </apex:inputField> <apex:actionStatus startText="applying value..." id="status"/> <apex:inputField value="{!Opportunity_Competitive_Analysis__c.how_perception_changed__c}" style="width:550px" rendered="{!Opportunity_Competitive_Analysis__c.perception_changed__c='Yes'}" required="true" /> </apex:outputPanel> </apex:actionRegion> <apex:outputText value="6" style="font-weight:bold" /> <apex:outputText value="did the customer call our references? if Yes, which one? If yes, Were they helpful" /> <apex:actionRegion> <apex:outputPanel id="reference"> <apex:inputField value="{!Opportunity_Competitive_Analysis__c.customer_called_references__c}" > <apex:actionSupport event="onchange" rerender="reference" status="status2"/> </apex:inputField> <apex:actionStatus startText="please wait, applying value..." id="status2"/> <apex:outputPanel id="referencename" rendered="{!Opportunity_Competitive_Analysis__c.customer_called_references__c='Yes'}" > <apex:inputField value="{!Opportunity_Competitive_Analysis__c.which_reference_called__c}" required="true" /> <apex:outputText value="---- Enter the reference name" /> </apex:outputPanel> <apex:outputPanel id="referencehelp" rendered="{!Opportunity_Competitive_Analysis__c.customer_called_references__c='Yes'}" > <apex:inputField value="{!Opportunity_Competitive_Analysis__c.Reference_Helpful__c}" style="width:500px" required="true" /> <apex:outputText value="---- were the references helpful?" /> </apex:outputPanel> </apex:outputPanel> </apex:actionRegion> <apex:outputText value="7" style="font-weight:bold" /> <apex:outputText value="why did we lose overall?" /> <apex:inputField value="{!Opportunity_Competitive_Analysis__c.main_reason_lost__c}" /> </apex:panelGrid>

 

When I change the field "customer called reference", I got validation rule on "were references helpful"? (you must enter a value). Even if I change it to "No" in which case the outputPanel for references should not be rendered.

 

What am I missing?

 

Thanks.

 

ckellieckellie

You need to use the pageBlock and pageBlockSection tags. use the following example for reference:

 

http://wiki.developerforce.com/index.php/Visualforce_DynamicEditPage

CTU007CTU007

I have another page using panelGrid and it works, I just wrapped the panelGrid inside a pageblockSection.....

 

I will try to modify this one to see if this is the issue.....

ckellieckellie
Are you able to use the panelgrid to display the dynamic areas side by side?
CTU007CTU007

Yes, I can use panelgrid to show columns I wanted with my own heading.

 

 

This was selected as the best answer
ckellieckellie
This worked great. Thank you. I justneed to work on the margins on this and it will be good to go. Thank you