You need to sign in to do that
Don't have an account?
Need help
Hi Guyz, Hope you can halp.. I attached 3 small screenshots to Explain my problem..
I have created a Visualforce page, and I need to achieve condition like below.. At first I'm checking the checkbox and it shows Screenshot and Additional screen shot section..

and When uncheck I has to show my page like Below screenshot,,

But with the knowledge I have in Javascript I could only achieve this :(
My Code
Appreciate your help. Thanks,
I have created a Visualforce page, and I need to achieve condition like below.. At first I'm checking the checkbox and it shows Screenshot and Additional screen shot section..
and When uncheck I has to show my page like Below screenshot,,
But with the knowledge I have in Javascript I could only achieve this :(
My Code
<apex:page standardController="SME_Coaching__c" extensions="smecoachingcontroller" id="page" > <apex:form id="form" > <!--**Java Script**--> <script type="text/javascript"> function ToggleInput(theId) { var e = document.getElementById(theId); if(e != null) { e.disabled = (e.disabled ? false : "disabled"); } } window.onload = function () { document.getElementById('{!$Component.textInput}').disabled = "disabled"; } </script> <apex:pageblock id="pb" > <apex:pageblockSection > <apex:pageblockSectionItem > <apex:actionRegion > <apex:inputcheckbox onchange="inputDisplay(this,'{!$Component.id1}')" selected="true"/> </apex:actionRegion> <apex:outputlabel value="Screenshot"/> </apex:pageblockSectionItem> <apex:inputfile id="id1" value="{!myfile.body}" filename="{!myfile.name}" /> <apex:pageblockSectionitem > <apex:outputlabel value="Additional Screenshot (Optional)"/> </apex:pageblockSectionitem> <apex:pageblockSectionitem > <apex:inputfile id="id1" value="{!myfile.body}" filename="{!myfile.name}" /> </apex:pageblockSectionitem> </apex:pageblockSection> </apex:pageblock> </apex:form> </apex:page>
Appreciate your help. Thanks,
just see the code below ,i till bit changes i done in your code,i checked that its working fine go on
visual force:
<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:inputfile id="id1" value="{!file1}" filename="{!name1}" rendered="{!file1ren}"/>
<apex:pageblockSectionitem >
<apex:outputlabel value="Additional Screenshot (Optional)"/>
</apex:pageblockSectionitem>
<apex:pageblockSectionitem >
<apex:inputfile id="id1" value="{!file2}" filename="{!name2}" 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 Blob file2 { get; set; }
public String name2 { get; set; }
public Blob file1 { get; set; }
public String name1 { get; set; }
public Boolean chbox { get; set; }
public PageReference chboxaction() {
if(chbox==true){
file1ren=true;
file2ren=true;
}
else{
file1ren=false;
file2ren=false;
}
return null;
}
}