You need to sign in to do that
Don't have an account?
Ap30
how to change outputtext value
Hello All,
I have created a visualforce page and apex which is used to calculate values and display in visualforce page. In a scenario, output text value has to be changed. I'm new to this. Kindly help.
<apex:page Controller="xxCalculator">
<apex:form >
<apex:pageBlock title="xx Calculator">
<apex:pageBlockSection >
<apex:inputText label="Number of 1:" value="{!num1}"/><br/>
<apex:inputText label="Number of 2:" value="{!num2}"/><br/>
<apex:commandButton value="Calculate" action="{!yyCalculate}" reRender="{!changeOutput}"/>
</apex:pageBlockSection>
</apex:pageBlock>
<br/>
<font color="red">
HERE YOUR OUTPUT is:<apex:outputText value="{!output1}" />
</font>
</apex:form>
</apex:page>
================
public class xxCalculator{
public String changeOutput{ get; set; }
public integer num1{set;get;}
public integer num2{set;get;}
public integer output1{set;get;}
public void yyCalculate(){
if(num1 == 1 && num2 == 1)
{
output1 = 0;
}
else if(num1 > 1 && num2 > 1 )
{
output1= (10 * num1) + (15 * num2);
}
}
public PageReference changeOutput(){
if(output1 > 60)
{
output1 = 60;
}
return null;
}
}
I have created a visualforce page and apex which is used to calculate values and display in visualforce page. In a scenario, output text value has to be changed. I'm new to this. Kindly help.
<apex:page Controller="xxCalculator">
<apex:form >
<apex:pageBlock title="xx Calculator">
<apex:pageBlockSection >
<apex:inputText label="Number of 1:" value="{!num1}"/><br/>
<apex:inputText label="Number of 2:" value="{!num2}"/><br/>
<apex:commandButton value="Calculate" action="{!yyCalculate}" reRender="{!changeOutput}"/>
</apex:pageBlockSection>
</apex:pageBlock>
<br/>
<font color="red">
HERE YOUR OUTPUT is:<apex:outputText value="{!output1}" />
</font>
</apex:form>
</apex:page>
================
public class xxCalculator{
public String changeOutput{ get; set; }
public integer num1{set;get;}
public integer num2{set;get;}
public integer output1{set;get;}
public void yyCalculate(){
if(num1 == 1 && num2 == 1)
{
output1 = 0;
}
else if(num1 > 1 && num2 > 1 )
{
output1= (10 * num1) + (15 * num2);
}
}
public PageReference changeOutput(){
if(output1 > 60)
{
output1 = 60;
}
return null;
}
}
Kindly find the solution.
Vf Page:
Apex Controller: If you find your Solution then mark it as the best answer.
Thanks and Regards
Suraj Tripathi.
All Answers
Kindly find the solution.
Vf Page:
Apex Controller: If you find your Solution then mark it as the best answer.
Thanks and Regards
Suraj Tripathi.