You need to sign in to do that
Don't have an account?
Dynamic Page Sections
I have a visualforce page that I'm working on and it's the first time I've used dynamic sections. I have an object called Work Orders. There are two different types of work orders 1)Sign Orders and 2)Design Orders. When either type is selected, I want the section to appear with the appropriate fields. So far, it seems to work fine when the user selects the "Sign" work order type. However, when the "Design Only" type is selected, "applying value..." appears next to the field and nothing happens until AFTER the user hits the save button. After the save button is pressed, appropriate section is shown. Why does it work correctly when the "Sign" type is selected and not the "Design Only" option.
<apex:page standardController="Work_Orders__c" sidebar="false"> <apex:sectionHeader title="Edit Work Order" subtitle="{!Work_Orders__c.name}"/> <apex:form > <apex:pageBlock title="Edit Work Order" id="thePageBlock" mode="edit"> <apex:pageMessages /> <apex:pageBlockButtons > <apex:commandButton value="Save" action="{!save}"/> <apex:commandButton value="Cancel" action="{!cancel}"/> </apex:pageBlockButtons> <apex:actionRegion > <apex:pageBlockSection title="Basic Information" columns="1"> <apex:inputField value="{!Work_Orders__c.name}"/> <apex:pageBlockSectionItem > <apex:outputLabel value="Work Order Type"/> <apex:outputPanel > <apex:inputField value="{!Work_Orders__c.WO_Type__c}"> <apex:actionSupport event="onchange" rerender="thePageBlock" status="status"/> </apex:inputField> <apex:actionStatus startText="applying value..." id="status"/> </apex:outputPanel> </apex:pageBlockSectionItem> <apex:inputField value="{!Work_Orders__c.Project__c}"/> <apex:inputField value="{!Work_Orders__c.Order_Status__c}"/> </apex:pageBlockSection> </apex:actionRegion> <apex:pageBlockSection title="Design Information" columns="1" rendered="{!Work_Orders__c.WO_Type__c == 'Design Only'}"> <apex:inputField value="{!Work_Orders__c.Design_Description__c}" /> </apex:pageBlockSection> <apex:pageBlockSection title="Sign Information" columns="2" rendered="{!Work_Orders__c.WO_Type__c == 'Sign'}"> <apex:inputField value="{!Work_Orders__c.Verbiage__c}"/> <apex:inputField value="{!Work_Orders__c.Background_Color__c}"/> <apex:inputField value="{!Work_Orders__c.Sign_Options__c}"/> <apex:inputField value="{!Work_Orders__c.Template__c}"/> <apex:inputField value="{!Work_Orders__c.Text_Color__c}"/> <apex:inputField value="{!Work_Orders__c.Vinyl_Style__c}"/> <apex:inputField value="{!Work_Orders__c.Vinyl_Type__c}"/> <apex:inputField value="{!Work_Orders__c.Width__c}"/> <apex:inputField value="{!Work_Orders__c.Type__c}"/> <apex:inputField value="{!Work_Orders__c.Material__c}"/> <apex:inputField value="{!Work_Orders__c.Order_Comments__c}"/> <apex:inputField value="{!Work_Orders__c.Type__c}"/> <apex:inputField value="{!Work_Orders__c.Type__c}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
Hi
I think .It must be checking from database value wheather Work__Order__c.Type__c has 'sign ' value or not .
why dont you try by using actionFunction .It will fullfill your requirement .
There is some code you can follow...
Did this post answers your question ,If so please mark it as solutions so that Others get benifited.
Thanks
asish
When I go to create the extension I get this- "Error: Compile Error: line 7:74 no viable alternative at character '' at line 7 column 74"
HI
will you kindely check this..
public String workOrderType{get;set;}
public PageReference getSelected() {
workOrderType = System.currentPageReference().getParameters().get('Mahavir');
if(workOrderType == 'Sign'){
display = 'visible';
}
else{
display = 'not visible';
}
return null;
}
}
Try this and let me know It works or not ....
Did this post answers your questions,If so please mark it solved so that others get benifited..
Thanks
asish
I still get the error- Error: WorkOrderExtension Compile Error: Variable does not exist: display at line 6 column 13
Hi
Please declaire a variable like this and let me know wheather it works or not
public String display{get;set;}
your final code...
DId this post answers your question,if so please mark it solved so that other's get benifited.
Thanks
asish
I'm not sure how to do that exactly.