You need to sign in to do that
Don't have an account?
אביב קסוטו
Read only property error on custom controller
I am trying to display a select list from a custom controller, and i get a "Read only property 'productsTitle'" error when trying to save the visualforce page.
My custom controller:
public class BpmIcountPayment{ private final Account account; public String productsTitle { get { return 'products for sale'; } } public BpmIcountPayment() { account = [SELECT Id, Name, Site FROM Account WHERE Id = :ApexPages.currentPage().getParameters().get('id')]; } public Account getAccount() { return account; } public List<SelectOption> getProductsLov() { List<SelectOption> products = new List<SelectOption>(); List<Product2> productsList = [SELECT Name, Family FROM Product2 WHERE (Family = 'ShopProduct') OR (Family = 'CourseParent') OR (Family = 'SFCourseProgram')]; for (Product2 currProduct : productsList) { products.add(new SelectOption(currProduct.Id, currProduct.Name)); } return products; } }
And my visualforce page:
<apex:page Controller="BpmIcountPayment"> <apex:param name="first_name" value="Account.FirstName"/> <apex:param name="last_name" value="Account.LastName"/> <apex:param name="id" value="Account.idnumber__c"/> <apex:param name="address" value="Account.Address"/> <apex:form> <apex:selectList value="{!productsTitle}" multiselect="false"> <apex:selectOptions value="{!ProductsLov}"></apex:selectOptions> </apex:selectList> </apex:form> </apex:page>
Change it below
All Answers
Change it below