You need to sign in to do that
Don't have an account?
LoneStar69
rendering section on checkbox selection
Hi Guys!!!
Adding code to already existing page using Cases obj.
Trying to show/hide fields using checkbox selection.
Thanks for your help!!!
<apex:pageBlockSectionItem id="SPContent">
<apex:inputField required="true" value="{!c.SP_Topics__c}" id="sptopics" />
</apex:pageBlockSectionItem>
<apex:actionRegion>
<apex:inputCheckbox value="{!c.SP_Selection__c}" id="SP" >
<apex:actionSupport event="onchange" reRender="SPContent" status="status" />
</apex:inputCheckbox>
</apex:actionRegion>
<apex:pageBlockSectionItem id="NonSPContent">
<apex:inputField required="true" value="{!c.Product__c}" id="prd" />
<apex:inputField required="true" value="{!c.Product_Type__c}" id="ptype" />
</apex:pageBlockSectionItem>
<apex:actionRegion>
<apex:inputCheckbox value="{!c.Non_SP_Selection__c}" id="NonSP" >
<apex:actionSupport event="onchange" reRender="NonSPContent" status="status" />
</apex:inputCheckbox>
</apex:actionRegion>
Adding code to already existing page using Cases obj.
Trying to show/hide fields using checkbox selection.
Thanks for your help!!!
<apex:pageBlockSectionItem id="SPContent">
<apex:inputField required="true" value="{!c.SP_Topics__c}" id="sptopics" />
</apex:pageBlockSectionItem>
<apex:actionRegion>
<apex:inputCheckbox value="{!c.SP_Selection__c}" id="SP" >
<apex:actionSupport event="onchange" reRender="SPContent" status="status" />
</apex:inputCheckbox>
</apex:actionRegion>
<apex:pageBlockSectionItem id="NonSPContent">
<apex:inputField required="true" value="{!c.Product__c}" id="prd" />
<apex:inputField required="true" value="{!c.Product_Type__c}" id="ptype" />
</apex:pageBlockSectionItem>
<apex:actionRegion>
<apex:inputCheckbox value="{!c.Non_SP_Selection__c}" id="NonSP" >
<apex:actionSupport event="onchange" reRender="NonSPContent" status="status" />
</apex:inputCheckbox>
</apex:actionRegion>
Try this below code what ever requirement written in above i done here,Example i can taken account field if what ever fields if you want you can take it ok.any query ask me
visualforce page
<apex:page Controller="coachingcontroller" id="page" >
<apex:form id="form" >
<apex:pageblock id="pb" >
<apex:pageblockSection >
<apex:pageblockSectionItem >
<apex:inputCheckbox value="{!chbox}">
<apex:actionSupport event="onclick" action="{!chboxaction}"/>
</apex:inputCheckbox>
<apex:outputlabel value="Screenshot"/>
</apex:pageblockSectionItem>
<apex:inputfield id="id1" value="{!acc.name}" rendered="{!file1ren}"/>
<apex:pageblockSectionitem >
<apex:outputlabel value="Additional Screenshot (Optional)"/>
</apex:pageblockSectionitem>
<apex:pageblockSectionitem >
<apex:inputfile id="id1" value="{!acc.phone}" rendered="{!file2ren}"/>
</apex:pageblockSectionitem>
</apex:pageblockSection>
</apex:pageblock>
</apex:form>
</apex:page>
controller:
public with sharing class coachingcontroller {
public coachingcontroller(){
file1ren=false;
file2ren=false;
}
public Boolean file2ren { get; set; }
public Boolean file1ren { get; set; }
public Boolean chbox { get; set; }
public Account acc {get;set;}
public PageReference chboxaction() {
if(chbox==true){
file1ren=true;
file2ren=true;
}
else{
file1ren=false;
file2ren=false;
}
return null;
}
}
If you get the answer, please mark it as the correct answer. It will be a help to others who are facing the same problem later.
Regards
Eswar Prasad
@Andy, @Shrikant
No matter what i do, i cannot see the fields on the vf page.
if i say,
<apex:inputField required="true" value="{!c.SP_Topics__c}" id="sptopics" />
or,
<apex:inputCheckbox value="{!c.SP_Selection__c}" id="SP" >
These fields do exist on the Case object.
Can't see it on the page, am i missing something?