You need to sign in to do that
Don't have an account?
White Hat
why there is an "unknown result" error even there is a controller on <apex:Page>
public class CALCI
{
public Integer a { get; set; }
public Integer b { get; set; }
public Integer r { get; set; }
public string o { get; set; }
public pageReference subb()
{
r = a - b;
o='substraction';
return null;
}
public pageReference add()
{
r = a + b;
o='addition';
return null;
}
public pageReference mul()
{
r = a * b;
o='multiplication';
return null;
}
}
--------------------------------------------------------------------------------------------------
<apex:page controller="CALCI" >
<apex:form>
<apex:pageBlock title="CALCI">
<apex:pageBlockSection columns="1" title="simple operations" collapsible="false">
<apex:pageBlockSectionItem>
<apex:outputLabel>Enter A</apex:outputLabel>
<apex:inputText value="{!a}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem>
<apex:outputLabel>Enter B</apex:outputLabel>
<apex:inputText value="{!b}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem>
<apex:outputLabel>you have performed {!o } of {!a} and {!b} and result is {!result}</apex:outputLabel>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
{
public Integer a { get; set; }
public Integer b { get; set; }
public Integer r { get; set; }
public string o { get; set; }
public pageReference subb()
{
r = a - b;
o='substraction';
return null;
}
public pageReference add()
{
r = a + b;
o='addition';
return null;
}
public pageReference mul()
{
r = a * b;
o='multiplication';
return null;
}
}
--------------------------------------------------------------------------------------------------
<apex:page controller="CALCI" >
<apex:form>
<apex:pageBlock title="CALCI">
<apex:pageBlockSection columns="1" title="simple operations" collapsible="false">
<apex:pageBlockSectionItem>
<apex:outputLabel>Enter A</apex:outputLabel>
<apex:inputText value="{!a}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem>
<apex:outputLabel>Enter B</apex:outputLabel>
<apex:inputText value="{!b}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem>
<apex:outputLabel>you have performed {!o } of {!a} and {!b} and result is {!result}</apex:outputLabel>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Use below code it works fine, you use {!result} instead of {!r} and it gives you an error
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Ajay Dubedi
www.ajaydubedi.com