function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Hiral Patel 25Hiral Patel 25 

showing error in this code

on this code showing error (Syntax error. Extra '1')

<apex:page>
<apex:form >
  <apex:pageBlock title="CALCULATOR">
  First Number: <apex:inputText value="{!First number}"/><br/><br/>
  Second Number : <apex:inputText value="{! Second number}" /><br/><br/>
   <apex:pageBlockButtons >
   <apex:commandButton value="ADD" action="{!addition}" />
       <apex:commandButton value="SUB" action="{!subtraction}" />
       
         <apex:commandButton value="DIV" action="{!division}" />
       <apex:commandButton value="MULTIPLY" action="{!multiplication}" />
      </apex:pageBlockButtons>
 
  <b>Output is:<apex:outputText value="{!result}"></apex:outputText></b>
  </apex:pageBlock>
 
  
  
  </apex:form>
</apex:page>
ANUTEJANUTEJ (Salesforce Developers) 
you need to add <apex:page controller="Sample"> to link visualforce page and controller.

Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.  

Thanks.
AnudeepAnudeep (Salesforce Developers) 
Hi Hiral, 

The problem is with the following lines of code in your VF page
 
First Number: <apex:inputText value="{!First number}"/><br/><br/>
  Second Number : <apex:inputText value="{! Second number}" /><br/><br/>

Try removing the space between {!First number} because that isn't the right way to use merge notation

I have tried this in my org and it gives me an Extra number error message

User-added image


A good example is the following
<apex:inputField value="{!Account.Name}" />

Also, note that if you remove the space, you might see the following error which means there isn't any field referenced in the controller with this name 
 
Error: Unknown property 'Firstnumber' referenced in agopagoni123__calculator


Let me know if this helps, if it does, please mark this answer as best so that others facing the same issue will find this information useful. Thank you