You need to sign in to do that
Don't have an account?
Jim Riggio 1
Display fields after checkbox is checked
I have a request to display 4 fields when a Checkbox is displayed. I don't won't this fields to display unless the checkbox is checked in order to safe real estate. I believe this has to be completed on a visualforce page, but not usre and don't know where to start. This will be displayed as a new section on the account page where several other sections reside. Is this possible without to much effort?
You can use something like this in this i am displaying contact first name , last name, email so you can change this code according to your requirement
Class : vf page:
Pls see 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