I have Vf page on Opportunity with custom controller. I need to make fields visible only after checkbox is checked. here is my code . something is missing . i'm getting fields hide all time.
Vf Page
<apex:page standardController="Opportunity" extensions="opportunityOrderDetail">
<apex:form >
<apex:pagemessages />
<apex:pageBlock title="Opportunity details">
<apex:pageBlockSection title="Opportnuity Infromation" >
<apex:inputField value="{! Opportunity.OwnerId }"/>
<apex:inputField value="{! Opportunity.Amount }"/>
<apex:inputField value="{! Opportunity.IsPrivate }"/>
<apex:inputField value="{! Opportunity.CloseDate }"/>
<apex:inputField value="{! Opportunity.Name }"/>
<apex:inputField value="{! Opportunity.NextStep}"/>
<apex:inputField value="{! Opportunity.Account.Name }"/>
<apex:inputField value="{! Opportunity.StageName }"/>
<apex:inputField value="{! Opportunity.Type }"/>
<apex:inputField value="{! Opportunity.Probability }"/>
<apex:inputField value="{! Opportunity.LeadSource }"/>
<apex:inputField value="{! Opportunity.CampaignId}"/>
<apex:inputField value="{! Opportunity.Status__c }"/>
<apex:inputField value="{! Opportunity.Primary_Customer_Email_Id__c}"/>
<apex:inputField value="{! Opportunity.Primary_Competitor__c }"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="Additional Information" >
<apex:inputCheckbox value="{!Opportunity.Order_Details__c}" onchange="{!click}" />
<apex:actionSupport event="onchange" reRender="thePanel" action="{!click}"/>
<apex:pageBlockSection title="Order Details" id="OrderDetails" rendered="{!displayInputputText}">
<apex:inputField value="{! Opportunity.OrderNumber__c }" />
<apex:inputField value="{! Opportunity.MainCompetitors__c }"/>
<apex:inputField value="{! Opportunity.CurrentGenerators__c }" />
<apex:inputField value="{! Opportunity.DeliveryInstallationStatus__c }" />
<apex:inputField value="{! Opportunity.TrackingNumber__c }" />
</apex:pageBlockSection>
</apex:pageBlockSection>
<apex:pageBlockSection title="Description Information" >
<apex:inputField value="{! Opportunity.Description }"/> <br/>
<apex:inputField value="{! Opportunity.Reason_for_Rejection__c}"/>
</apex:pageBlockSection>
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="save"/>
<apex:commandButton action="{!save}" value="Save & New"/>
<apex:commandButton action="{!cancel}" value="cancel"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
Here is My Custom Controller
public class opportunityOrderDetail {
public Opportunity oppty{get;set;}
public Boolean displayInputputText{get;set;}
public opportunityOrderDetail(ApexPages.StandardController controller){
oppty=(Opportunity)controller.getRecord();}
public PageReference click(){
if(oppty.Order_Details__c==true){
displayInputputText = true;
}
else{
displayInputputText = false;
}
return null;
}
}