+ Start a Discussion
NiknitNiknit 

formula Expression required error in my custom controller?

 

What I am trying to do is make a page where if i click on button then all accounts with type "prospect" to be shown. below is all my code :

 

Error: Formula expression is required for attribute value in in q4controller at line 7 column 58
VF code

<apex:pageblock title = "List of accounts">

                <apex:pageblocktable value="{! acts }" var="a">

                    <apex:column value="{ !a.Name } " /> 
                    <apex:column value="{ !a.Type }" />    
                    <apex:column value="{ !a.Industry }" />

                </apex:pageblocktable>


       </apex:pageblock>


</apex:page>



******Controller class******

Public class q4{

List<account> acts;

public list<account> getacts(){
acts = [Select name,type,industry from account where type = 'Prospect'];
return acts;
}



}
 




what is this error, i don't understand. i have tried googling but wasnt able to pin point what the issue is.also i am new to this so please scuse and silly mistake.
Thanks

BALAJI CHBALAJI CH
Hi Nitin,

The space is causing the error. We cannot give space between { and ! in a formula attribute. You can change this "{!a.Name } " to "{!a.Name }".
Please find below modified VF Page:
<apex:pageblock title = "List of accounts">

                <apex:pageblocktable value="{!acts }" var="a">

                    <apex:column value="{!a.Name }" /> 
                    <apex:column value="{!a.Type }" />    
                    <apex:column value="{!a.Industry }" />

                </apex:pageblocktable>

       </apex:pageblock>

</apex:page>

Let me know if tat helps you.

Best Regards,
BALAJI