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
DannyK89DannyK89 

Unknown Property Error Confusion

Hi Everyone,

 

I am having a problem with some code I am trying to write. I want to create a calculator inside salesforce. When I try to add a output text tag with a variable in it I keep getting the unknown property error.

The variable is defined in my custom apex controller. IT has a getter and setter methods and is set to public. I don't understand what the problem is?

Can someone help me out. 

 

Below is my code that I have created so far:

 

Visualforce page:

<apex:page controller="DirectHireCalcController">
<apex:form >
<apex:page >
    <apex:pageBlock title="Direct Hire Fee Calculator">
        <apex:pageBlockSection columns="1">
            <apex:pageBlockSectionItem helpText="This value is automatically calculated. Do not enter a value.">
                <apex:outputLabel value="Direct Hire Fee"/>
                <apex:outputPanel id="DirectHireFee">
                    <input type="text" value="" readonly="readonly" style="color:black; font-weight:bold; border:1px solid #AEAEAE; background-color:white;"/>
                    <!--<apex:inputText label="Gross Margin Pct" value="{!GrossPctString}" disabled="true" style="color:black; font-weight:bold; border:1px solid #AEAEAE; background-color:white;"/>-->
                </apex:outputPanel>
            </apex:pageBlockSectionItem>
            <apex:outputText >
                {!DHPercent}
            </apex:outputText>
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>
</apex:form>
</apex:page>

Controller:

public class DirectHireCalcController {
    public String DHFee {get; set;}
    public String DHPercent {get; set;}
    public DirectHireCalcController(){}
}

 

 

Thanks,

Best Answer chosen by Admin (Salesforce Developers) 
Naidu PothiniNaidu Pothini
<apex:page controller="DirectHireCalcController">
<apex:form >

    <apex:pageBlock title="Direct Hire Fee Calculator">
        <apex:pageBlockSection columns="1">
            <apex:pageBlockSectionItem helpText="This value is automatically calculated. Do not enter a value.">
                <apex:outputLabel value="Direct Hire Fee"/>
                <apex:outputPanel id="DirectHireFee">
                    <input type="text" value="" readonly="readonly" style="color:black; font-weight:bold; border:1px solid #AEAEAE; background-color:white;"/>
                    <!--<apex:inputText label="Gross Margin Pct" value="{!GrossPctString}" disabled="true" style="color:black; font-weight:bold; border:1px solid #AEAEAE; background-color:white;"/>-->
                </apex:outputPanel>
            </apex:pageBlockSectionItem>
            <apex:outputText >
                {!DHPercent}
            </apex:outputText>
        </apex:pageBlockSection>
    </apex:pageBlock>

</apex:form> </apex:page>

 You have extra page tags inside the page. remove them

All Answers

Naidu PothiniNaidu Pothini
<apex:page controller="DirectHireCalcController">
<apex:form >

    <apex:pageBlock title="Direct Hire Fee Calculator">
        <apex:pageBlockSection columns="1">
            <apex:pageBlockSectionItem helpText="This value is automatically calculated. Do not enter a value.">
                <apex:outputLabel value="Direct Hire Fee"/>
                <apex:outputPanel id="DirectHireFee">
                    <input type="text" value="" readonly="readonly" style="color:black; font-weight:bold; border:1px solid #AEAEAE; background-color:white;"/>
                    <!--<apex:inputText label="Gross Margin Pct" value="{!GrossPctString}" disabled="true" style="color:black; font-weight:bold; border:1px solid #AEAEAE; background-color:white;"/>-->
                </apex:outputPanel>
            </apex:pageBlockSectionItem>
            <apex:outputText >
                {!DHPercent}
            </apex:outputText>
        </apex:pageBlockSection>
    </apex:pageBlock>

</apex:form> </apex:page>

 You have extra page tags inside the page. remove them

This was selected as the best answer
DannyK89DannyK89

Oh Wow, I feel really dumb now. I guess that's what happens when you copy code without looking at what you're copying.

 

Thanks for the help, and I apologize for my stupidity.