You need to sign in to do that
Don't have an account?

In UI page there is no chnage after writing VF codes and Apex class.
Here are my VF codes and Apex Class
<apex:page controller="Calc" >
<apex:form>
<apex:sectionHeader title="Contact" subtitle="New Contact"/>
<apex:pageBlock title="Contact Edit" Tabstyle="Contact" id="tryReneder">
<apex:pageBlockButtons>
<apex:commanButton action="{!add}" value="Add" Reneder="tryReneder"/>
<apex:commandButton action="{!redirect}" value="navigate"/>
</apex:pageBlockButtons>
<apex:pageBlockSection columns="2">
<apex:pageBlockSectionItem>
<apex:outputLabel value="Input1"/>
<apex:inputText value="{!input"}/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem>
<apex:outputLabel value="Input2"/>
<apex:inputText value="{!input}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem>
<apex:outputLabel value="output"/>
<apex:inputText value="{!output}"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
public class Calc {
public Integer input1;
public Integer input2;
public Integer output;
// Constructor
public Calc(){
this.input1=0;
this.input2=0;
this.output=0; //
}
//Getter and Setter method
//Getter method to get value from Apex to VF page
//Setter method is to set values from VF to Apex class
public Integer getInput(){
return input1;
}
public void setInput1(Integer input1){
this.input1=input1;
}
public Integer getoutput(){
return output;
}
public void setoutput(Integer output){
this.output=output;
}
public Integer getinput2(){
return input2;
}
public void setinput2(Integer input2){
this.input2=input2;
}
//add Method
//addtwoinputs
public void add(){
this.output=this.input1+this.input2;
}
// Redirect method to demo pagereference
public PageReference redirect(){
system.debug('lol');
pagereference p = new PageReference('/apex/CustomCalcContact');
return p;
}
}
<apex:page controller="Calc" >
<apex:form>
<apex:sectionHeader title="Contact" subtitle="New Contact"/>
<apex:pageBlock title="Contact Edit" Tabstyle="Contact" id="tryReneder">
<apex:pageBlockButtons>
<apex:commanButton action="{!add}" value="Add" Reneder="tryReneder"/>
<apex:commandButton action="{!redirect}" value="navigate"/>
</apex:pageBlockButtons>
<apex:pageBlockSection columns="2">
<apex:pageBlockSectionItem>
<apex:outputLabel value="Input1"/>
<apex:inputText value="{!input"}/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem>
<apex:outputLabel value="Input2"/>
<apex:inputText value="{!input}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem>
<apex:outputLabel value="output"/>
<apex:inputText value="{!output}"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
public class Calc {
public Integer input1;
public Integer input2;
public Integer output;
// Constructor
public Calc(){
this.input1=0;
this.input2=0;
this.output=0; //
}
//Getter and Setter method
//Getter method to get value from Apex to VF page
//Setter method is to set values from VF to Apex class
public Integer getInput(){
return input1;
}
public void setInput1(Integer input1){
this.input1=input1;
}
public Integer getoutput(){
return output;
}
public void setoutput(Integer output){
this.output=output;
}
public Integer getinput2(){
return input2;
}
public void setinput2(Integer input2){
this.input2=input2;
}
//add Method
//addtwoinputs
public void add(){
this.output=this.input1+this.input2;
}
// Redirect method to demo pagereference
public PageReference redirect(){
system.debug('lol');
pagereference p = new PageReference('/apex/CustomCalcContact');
return p;
}
}
What are the expected changes on UI? Are you seeing any errors while executing the code?
and it's a Calc UI so i expected input and output when i entered the two values then i'll get output on UI.