It sounds like you are writing a Visual Force page and controller. In your controller, set a public variable true or false, and then add the render= attribute to 2 different page elements (like <apex:outputField> and <apex:outputText>) only 1 will render at a time.
<apex:page controller="MySampleController">
<apex:form>
<apex:inputCheckBox value="{!isChecked}" />
<apex:outputText value="Eligible for Discount" />
<apex:commandButton value=""
<apex:outputField value="{!SampleValue}" />
</apex:form>
</apex:page>
------ controller logic.
public with sharing class MySampleController
{
public String sampleValue { get; set; } // to assign the value to be displayed on VF page
public BOOLEAN isChecked { get; set; } // if the user checks the checkbox i.e. true
public void doDisplay()
{
if(isChecked) // if the user checks the checkbox
{
sampleValue = Total - discount;// do your calculation here.
}
else // if not checked i.e. false
sample Value
{
sampleValue = directValue.i.e.FormulaFieldValue;
}
}
}
please let me know whether I have understood your requirement, I am ready to solve even if your requirement is something other.
It sounds like you are writing a Visual Force page and controller. In your controller, set a public variable true or false, and then add the render= attribute to 2 different page elements (like <apex:outputField> and <apex:outputText>) only 1 will render at a time.
plz check whehter you are looking for this.
please let me know whether I have understood your requirement, I am ready to solve even if your requirement is something other.