You need to sign in to do that
Don't have an account?
lammy
Visualforcepage error: Save error: Unknown property 'AccountStandardController.ls'. Please Help!!!
I am having difficulty with a visualforce page recognizing an object variable on an extension. I have a feeling the problem is with my getter method, but I am at a loss for how to fix it. Attached is my controller and page...
Page: <apex:page standardController="Account" extensions="RSOLeaseExtension" tabStyle="Lease__c"> <apex:sectionHeader title="New Lease Request" subtitle="Lease Form"/> <apex:pageMessages /> <apex:form > <apex:pageBlock title="Lease Form" id="Lease"> <apex:pageBlockButtons location="top"> <apex:commandButton value="Save" action="{!save}" /> <apex:commandButton value="Cancel" action="{!cancel}" immediate="true" /> </apex:pageBlockButtons> <apex:pageBlockSection title="Account Details"> <apex:inputField value="{!ls.DBA_Name__c}"/> <apex:outputField value="{!ls.Merchant_Number__c}"/> <apex:inputField required="true" value="{!ls.Request_Type__c}"> <apex:actionSupport event="onchange" rerender="Lease" /> </apex:inputField> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page> Controller: public with sharing class RSOLeaseExtension { private final Account account; private Account acc = null; private Lease__c ls = new Lease__c(); public String reType = getRequestType(); public RSOLeaseExtension(ApexPages.StandardController controller) { this.account = (Account)controller.getRecord(); if (this.account.Id != null && acc == null) { acc = [SELECT Id, Bank_Lookup__c,Bank_Lookup__r.Name, OwnerId,Owner.Phone,Owner.Email,Merchant_MID__c,Name FROM Account WHERE Id = :this.account.Id]; ls.Merchant_Number__c = acc.Merchant_MID__c; ls.DBA_Name__c = acc.Id; ls.Bank_Alliance_Name__c = acc.Bank_Lookup__r.Name; } } public Lease__c getLease() { return ls; } public String getRequestType() { return ls.Request_Type__c; } public PageReference save() { PageReference savePage = null; Savepoint sp = null; RecordType lsRec = [Select Id,Name from RecordType where Name like 'Lease%' and SobjectType = 'Lease__c']; try { sp = Database.setSavepoint(); insert ls; savePage = new PageReference('/' + ls.Id); savePage.setRedirect(true); } catch (System.DmlException de) { ApexPages.addMessages(de); Database.rollback(sp); } return savePage; } public PageReference cancel() { PageReference cancelPage = null; if (account.Id != null) { cancelPage = new PageReference('/' + account.Id); } else { cancelPage = new PageReference('/001/o'); } cancelPage.setRedirect(true); return cancelPage; } }
Thank you for any help!!!!
you are using
ls.DBA_Name__c and similar other properties in VFP but in controller you dont have any public property ls or any getter method like
getls() , intead you ls in controller is private variable and you have getLease method.
I hope you will figure out the error now.
All Answers
you are using
ls.DBA_Name__c and similar other properties in VFP but in controller you dont have any public property ls or any getter method like
getls() , intead you ls in controller is private variable and you have getLease method.
I hope you will figure out the error now.
Just thought I would try one more thing and it worked, it was my getter, I changed it to getLs() and it works. Whew...