3

I am aware that apex:inputField can be used only with Sobject fields. In my VF page below I am trying to use apex:inputFieldagainst an Sobject field only but still it is giving me the following error.

Could not resolve the entity from <apex:inputField> value binding '{!ff.First_Name__c}'. <apex:inputField> can only be used with SObjects, or objects that are Visualforce field component resolvable.

Can someone let me know where and what I am missing here ? The first error occurs in the following line

<span class="ff_input"><apex:inputField id="ffinp1" value="{!ff.First_Name__c}"/></span>

My VF page

<apex:page standardController="Service_Enquiry__c" extensions="ServiceEnquiryUIController" tabStyle="Service_Enquiry__c">
    <script src="//code.jquery.com/jquery-1.10.2.js"></script>
    <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
    <apex:stylesheet value="{!URLFOR($Resource.LightningDesignSystemMin)}"/>
    <apex:includeScript value="{!$Resource.cbpFWTabs}"/>
    <apex:includeScript value="{!$Resource.modernizr}"/>    
    <style type="text/css"> 
        .se_details{
            font-size:13px;            
        }

        .se_details td{
            width:50%;
            text-align:left;
            padding-top:1%;
            position:relative;
            left:5.5%;
        }

        .se_label{

        }

        .se_input{
            color:#0080FF;
        }

        .value{
            color:#0080FF;
            /*color:#99FF00;*/
        }

        .factfind{
            font-size:13px;
        }

        .factfind td{
            width:50%;
            text-align:right;
            position:relative;
            right:28%;
            padding-top:1%;
        }

        .ff_label{
            color:#4C50A9;
            /*color:#99FF00;*/
        }
        .ff_input{
            color:#333333;
            /*color:#99FF00;*/
        }

        /*****************************/
        /* Status Nav */
        /*****************************/

        .nav {
            padding: 0;
            list-style-type: none;
            font-family: Arial;
            font-size: 14px;
            clear: both;
            line-height: 1em;
            margin: 0 -1px;
            text-align: center;        
            z-index:-2;
            white-space: nowrap;
            overflow-x:hidden;          
        }

        .nav li{
            display:table-cell;
            float: none;
            padding: 10px 30px 10px 40px;
            font-family: Arial;
            font-size: 14px;
            background: #3366cc;
            color: #fff;
            position: relative;
            border-top: 1px solid #fff;
            border-bottom: 1px solid #fff;
            border-left:2px solid #fff;
            width:20%;
            margin: 0 1px;
        }

        .nav li:before {
            content: '';
            border-left: 17px solid #fff;
            border-top: 17px solid transparent;
            border-bottom: 17px solid transparent;
            position: absolute;
            top: 0;
            left: 0;

        }

        .nav li:after {
            content: '';
            border-left: 17px solid #3366cc;
            border-top: 17px solid transparent;
            border-bottom: 17px solid transparent;
            position: absolute;
            top: 0;
            left: 100%;
            z-index: 20;
        }

        .nav li.active {
            background: #00CC66;
        }

        .nav li.active:after {
            border-left-color: #00CC66;
        }

        .nav li.inactive {
            background: #3366cc;
        }

        .nav li.inactive:after {
            border-left-color: #3366cc;
        }

        /*****************************/
        /* Content */
        /*****************************/
        .content-wrap {
            position: relative;
        }

        .content-wrap section {
            display: none;
            margin: 0 auto;
            padding: 1em;
            max-width: auto;
            text-align: center;
            background-color:#ccccff;
            /*background-color:#99FF00;*/

        }

        .content-wrap section.content-current {
            display: block;
        }

        .content-wrap section p {
            margin: 0;
            padding: 0.75em 0;
            color: #E3E3E3;
            font-family: Arial;
            font-weight: 300;
            font-size: 4em;
            line-height: 1;
        }


        .tabs {
            position: relative;
            overflow: hidden;
            margin: 0 auto;
            width: 100%;
            font-weight: 300;
            font-size: 1.25em;
        }

        /* Tab Nav */
        .tabs nav {
            text-align: center;       
        }

        .tabs nav ul {
            position: relative;
            display: -ms-flexbox;
            display: -webkit-flex;
            display: -moz-flex;
            display: -ms-flex;
            display: flex;
            margin: 0 auto;
            padding: 0;
            max-width: auto;
            list-style: none;
            -ms-box-orient: horizontal;
            -ms-box-pack: center;
            -webkit-flex-flow: row wrap;
            -moz-flex-flow: row wrap;
            -ms-flex-flow: row wrap;
            flex-flow: row wrap;
            -webkit-justify-content: center;
            -moz-justify-content: center;
            -ms-justify-content: center;
            justify-content: center;
        }

        .tabs nav ul li {
            position: relative;
            z-index: 1;
            display: block;
            margin: 0;
            text-align: center;
            -webkit-flex: 1;
            -moz-flex: 1;
            -ms-flex: 1;
            flex: 1;
        }

        .tabs nav a {
            position: relative;
            display: block;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            line-height: 2.5;
        }

        .tabs nav a span {
            vertical-align: middle;
            font-size: 0.75em;
            font-family: Arial;        
        }

        .tabs nav li.tab-current a {
            color: #3366cc;
        }

        .tabs nav a:focus {
            outline: none;
        }


        /*****************************/
        /* Line */
        /*****************************/

        .tabs-style-line nav ul {
            padding: 0 2em;
            max-width: none;
            box-shadow: inset 1 -1px #999;
        }

        .tabs-style-line nav a {
            padding: 0.7em 0.4em;
            box-shadow: inset 0 -1px #999;
            color: #999;
            text-align: left;
            text-transform: uppercase;
            letter-spacing: 1px;
            font-weight: 700;
            font-size: 1em;
            line-height: 3;
            -webkit-transition: color 0.3s, box-shadow 0.3s;
            transition: color 0.3s, box-shadow 0.3s;
        }

        .tabs-style-line nav a:hover,
        .tabs-style-line nav a:focus {        
            box-shadow: inset 0 -3px  #00CC66;
            color: #00CC66;
            text-decoration: none;
        }

        .tabs-style-line nav li.tab-current a {        
            box-shadow: inset 0 -3px #3366cc;
            color: #3366cc;
        }

        .section{
            font-size:15px;
            color:#333333;
        }        
    </style>
    <script type="text/javascript">
        function ServiceEnquiryStageTracking(){
            $('[id$=nav]').addClass('nav');
            $('[id$=nav]').children().each(function(){
                var status = '{!se.Status__c}';

                if($(this).text() == status){
                    $(this).addClass('active');
                    return false;
                }else{
                    $(this).addClass('active');
                }                
            });             
        }  

        $(document).ready(function(){
            ServiceEnquiryStageTracking();
            [].slice.call( document.querySelectorAll( '.tabs' ) ).forEach( function( el ) {
                new CBPFWTabs( el );
            });            
        })
    </script>

    <div class="slds-page-header">
        <div class="slds-col slds-has-flexi-truncate">
            <p class="slds-text-heading--label">Service Enquiry</p>
            <div class="slds-grid">
                <div class="slds-grid slds-type-focus slds-no-space">
                    <h1 class="slds-text-heading--medium slds-truncate" title="Service Enquiry">{!se.Name}</h1>
                </div>
            </div>
        </div>
    </div><br/>  

    <apex:form id="form">
        <apex:actionFunction id="cancel" name="cancel" action="{!cancel}"/>
        <apex:actionFunction id="saveFactFind" name="saveFactFind" action="{!saveFactFind}"/>

        <!-- Start -- Service Enquiry Nav Bar -->
        <table border="0">
            <tr>
                <td>                       
                    <apex:dataList id="nav" value="{!li_Service_Enquiry_Nav_Bar}" var="nav">
                        <apex:outputText value="{!nav}"/>                        
                    </apex:dataList>                    
                </td>
                <td>
                    <!--apex:image id="image2" value="{!$Resource.SEImage2}" width="40" height="40" rendered="{!se.Status__c == 'Opportunity Generated'}"/-->
                    <!--apex:image id="image1" value="{!$Resource.SEImage1}" width="40" height="40" rendered="{!se.Status__c == 'Opportunity Generated'}"/-->
                </td>                
            </tr>
        </table><br/>
        <!-- End -- Service Enquiry Nav Bar -->        

        <table border="0" class="se_details">
            <tr>
                <td>
                    <span class="se_label">Account Name: </span>
                    <span class="se_input"><apex:outputField id="account_name" value="{!se.Account__c}"/></span>
                </td>

                <td>
                    <span class="se_label">Owner:</span>
                    <span class="se_input"><apex:outputField id="owner" value="{!se.OwnerId}"/></span>
                </td>

            </tr>
            <tr>
                <td>
                    <span class="se_label">Home Phone: </span>
                    <span class="se_input"><apex:outputField id="phone" value="{!se.Home_Phone__c}"/></span>
                </td>
                <td>
                    <span class="se_label">Product:</span>
                    <span class="se_input"><apex:outputField id="product" value="{!se.Product__c}"/></span>
                </td>
            </tr>
            <tr>
                <td>
                    <span class="se_label">Email:</span> 
                    <span class="se_input"><apex:outputField id="email" value="{!se.Email__c}"/></span>
                </td>
                <td>
                    <span class="se_label">Source/Campaign:</span> 
                    <span class="se_input"><apex:outputField id="source_campaign" value="{!se.Campaign__c}"/></span>
                </td>
            </tr>
            <tr>
                <td>
                    <span class="se_label">Status:</span> 
                    <span class="se_input"><apex:outputField id="status" value="{!se.Status__c}"/></span>
                </td>
                <td>
                    <span class="se_label">Duration:</span> 
                    <span class="se_input"><apex:outputField id="duration" value="{!se.Duration__c}"/></span>
                </td>
            </tr>          
        </table><br/>       

        <!-- Instances Related to the service enquiry  -->
        <table>
            <tr>
                <td>

                    <div class="tabs tabs-style-line">
                        <nav>
                            <ul>
                                <apex:variable id="fact_find_tab" var="ff" value="Fact Find">
                                    <li><a href=""><span>Fact Find</span></a></li>
                                 </apex:variable>
                                <apex:variable id="upstream_service_tab" var="us" value="Upstream Services">
                                    <li><a href=""><span>Upstream Services</span></a></li>
                                </apex:variable>
                                <apex:variable id="downstream_service_tab" var="ds" value="Downstream Services">
                                    <li><a href=""><span>Downstream Services</span></a></li>
                                </apex:variable>  
                                <apex:variable id="referral_tab" var="r" value="Referral">
                                    <li><a href=""><span>Referral</span></a></li>
                                </apex:variable>
                                <apex:variable id="log_a_call_tab" var="lc" value="Log a Call">
                                    <li><a href=""><span>Log a Call</span></a></li>
                                </apex:variable>                               
                            </ul>
                        </nav>
                        <div class="content-wrap">
                            <section id="section-line-1">
                                <!--<p>Fact Find Details</p>-->
                                <!--apex:repeat id="account_content" value="{!li_sc_account}" var="acc">-->
                                    <table border="0" class="factfind">                                    
                                        <tr>
                                            <td>
                                                <span class="ff_label">First Name:</span>
                                                <span class="ff_input"><apex:inputField id="ffinp1" value="{!ff.First_Name__c}"/></span>
                                            </td>
                                            <td>
                                                <span class="ff_label">Last Name:</span>
                                                <span class="ff_input"><apex:inputField id="ffinp2" value="{!ff.Last_Name__c}"/></span> //ERROR HERE
                                            </td>                                            
                                        </tr>

                                        <tr>
                                            <td>
                                                <span class="ff_label">Title:</span>
                                                <span class="ff_input"><apex:inputField id="ffinp3" value="{!ff.Title__c}"/></span>
                                            </td>
                                            <td>
                                                <span class="ff_label">Dependents:</span>
                                                <span class="ff_input"><apex:inputField id="ffinp4" value="{!ff.Dependents__c}"/></span>
                                                <!--<span class="ff_input"><apex:inputText id="ffinp4" value="{!se.Home_Phone__c}"/></span>-->

                                            </td>                                            

                                        </tr>

                                    </table><br/><br/> 

                                    <apex:pageBlock >
                                    <apex:outputPanel id="incexpHead">
<apex:variable value="{!0}" var="rowNum" />
<apex:pageBlockSection columns="1" title="Add Incomes/Expenses" id="thePBS" collapsible="False">

    <apex:pageBlockTable value="{!IncExpList}" var="eachRecord">

    <apex:column headerValue="Action">
             <apex:commandLink value="Remove" style="color:red" action="{!removeRow}" rendered="{!rowNum > 0}" rerender="incexpHead" immediate="true">
                    <apex:param value="{!rowNum}" name="rowToRemove" assignTo="{!rowToRemove}"/>
                  </apex:commandLink>
                  <apex:variable var="rowNum" value="{!rowNum +1}"/>
                  </apex:column>

                 <apex:column headerValue="Income/Expense">
                        <apex:inputField value="{!eachRecord.record.Income_Expense__c}" required="true" />
                </apex:column>

               <apex:column headerValue="Type">
                     <apex:inputField value="{!eachRecord.record.Type__c}" required="true" />
               </apex:column>

               <apex:column headerValue="Frequency">
                                   <apex:inputField value="{!eachRecord.record.Frequency__c}" required="true" />
               </apex:column>

               <apex:column headerValue="Amount">
                                 <apex:inputField value="{!eachRecord.record.Amount__c}" required="true" />
              </apex:column>

             </apex:pageBlockTable>
            </apex:pageBlockSection>
            <apex:commandButton value="Add More" action="{!addNewRow}" rerender="incexpHead" Status="status" immediate="true" />
</apex:outputPanel>
</apex:pageBlock>

                                <!--</apex:repeat-->
                            </section>
                            <section id="section-line-2" class="section">
                                <p>Upstream services being worked on</p>
                                <!--apex:repeat id="loan_capacity_content" value="{!li_loan_capacity}" var="lp">
                                     <table>
                                        <tr>
                                            <td><p>Loan Capacity Number: &nbsp;&nbsp;&nbsp;{!lp.Name}</p> </td>
                                            <td><p>Realty or Home Loan Opportunity: &nbsp;&nbsp;{!lp.Realty_Opportunity__c}</p> </td>
                                        </tr>
                                        <tr>
                                            <td><p>Property Value: &nbsp;&nbsp;{!lp.Property_Value__c}</p> </td>
                                            <td><p>Loan Amount: &nbsp;&nbsp;{!lp.Loan_Amount__c}</p> </td>
                                        </tr>                                    
                                    </table><br/><br/>  
                                </apex:repeat-->
                            </section>
                            <section id="section-line-3" class="section"><p>Downstream services to be planned</p></section>
                            <section id="section-line-4" class="section"><p>Referral Details</p></section>
                            <section id="section-line-5" class="section"><p>Log a call - activities</p></section>

                        </div>
                    </div><!-- /tabs -->
                </td>
            </tr>
            <tr><td><br/><br/></td></tr>
        </table>

        <!-- Start -- Nav Button -->
        <table border="0">
            <tr>
                <td>                         
                    <input type="button" id="btn_cancel" value="Exit" onclick="cancel()" class="slds-button slds-button--neutral" style="color:#333333; font-family:Arial; font-size:15px; width:200px; position:relative; left:40%;"/> 
                    <input type="button" id="btn_save" value="Ignore" onclick="saveFactFind()" class="slds-button slds-button--neutral" style="color:#333333; font-family:Arial; font-size:15px; width:200px; position:relative; left:40%;"/> 
                </td>
            </tr>
        </table>
        <!-- End -- Nav Button -->          
    </apex:form>
</apex:page>

Controller

public class ServiceEnquiryUIController {
    public ApexPages.standardController st_controller;
    public Service_Enquiry__c se{get; set;}
    public FactFind__c ff{get;set;}
    public List<WrapperIncomesExpensesList> IncExpList{get;set;}
    public List<String> li_Service_Enquiry_Nav_Bar{get; set;}
    public Integer rowToRemove{get;set;}



    public class WrapperIncomesExpensesList
    {
    public Integer index{get;set;}
    public IncomeExpenses__c record{get;set;}
    }

    public ServiceEnquiryUIController (ApexPages.StandardController stdController){
        st_controller = stdController;

        se = getServiceEnquiry(st_controller.getId());


        List<FactFind__c> fflist = [SELECT ID,First_Name__c,Last_Name__c,Title__c,Dependents__c FROM FactFind__c WHERE Service_Enquiry__c = :st_controller.getId()];
        if(!fflist.isEmpty())
        {
            ff = fflist[0];
        }
        else
        {
            FactFind__c ff_p = new FactFind__c();
            ff = ff_p;
        }

        IncExpList = new List<WrapperIncomesExpensesList>();
        li_Service_Enquiry_Nav_Bar = getServiceEnquiryNavBar();
    }

    public List<String> getServiceEnquiryNavBar(){
        List<String> li_nav = new List<String>();
        for(SelectOption option : CommonUsedClass.getPicklistValue('Service_Enquiry__c', 'Status__c')){
            if(option.getValue() != 'Lost'){
                li_nav.add(option.getLabel());    
            }           
        }
        return li_nav;
    }



    public Service_Enquiry__c getServiceEnquiry(String seId){
        Service_Enquiry__c se1 = new Service_Enquiry__c();
        String queryStr = 'Select ' + CommonUsedClass.sObjectGetAllFields(se1).trim() + ' From Service_Enquiry__c Where Id = : seId';
        try{
           se1 = Database.query(queryStr);     
        }
        catch(Exception e){
            system.debug('****** Querying Service Enquiry Exception: ' + e.getMessage()); 
        }
        return se1;
    }

    public void addNewRow()
    {
       IncExpList = FactFindUIHelper.addNewRows(IncExpList);

    }

    public void removeRow()
    {
       IncExpList = FactFindUIHelper.removeRow(rowToRemove,IncExpList);
    }

    public PageReference saveFactFind()
    {
        //upsert ff;
        PageReference ffdetail = new PageReference('/'+se.Id);
        ffdetail.setRedirect(true);
        return ffdetail;
    }
}

1 Answer 1

4

This part where you create a new variable:

<apex:variable id="fact_find_tab" var="ff" value="Fact Find">
    <li><a href=""><span>Fact Find</span></a></li>
</apex:variable>

Is causing the compiler to get confused with your public getter/setter:

public FactFind__c ff{get;set;}

You need to rename one or the other.

2
  • @sfdcfox : I was looking into this...quite amazing on your part to exactly identify that the compiler is getting confused because of variable names :) and has nothing to do with syntax, tag etc
    – Varun
    Oct 11, 2016 at 1:09
  • 2
    @ZenSeeker Actually, I've has this issue before. The compiler is terribly unforgiving, so when you've been doing this as long as I have, you tend to learn about the quirks. Even though there was a lot of code, I had a feeling it was a simple matter of there being two "ff" values it was deciding between, so a simple Ctrl-F in the browser identified the issue pretty quickly. Now that you've seen it, you know to watch out for this, too!
    – sfdcfox
    Oct 11, 2016 at 2:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .