I need to be able to update ONLY the website and BillingAddress fields. As of right now I can't get any of the fields to update.
APEX:
public class AccountTypeController
{
public Account filterAccount{get; set;}
public Account[] recordList{get; set;}
public Account[] updateList{get; set;}
public List <Account> acc {get;set;}
public AccountTypeController()
{
filterAccount = new Account();
recordList = new List<Account>();
acc= Database.query('select Name,id from Account Limit 10');
}
public void updateRecordList()
{
recordlist = new List<Account>();
recordList=[Select Name, Type, Website, BillingStreet, BillingCity, BillingState,
BillingPostalcode, BillingCountry
From Account Where Type = :filterAccount.Type];
if(recordList.size()>0)
{
filterAccount = recordList[0];
}
}
public pageReference save()
{
updateList = [Select ID, Name, Type, Website, BillingStreet, BillingCity, BillingState,
BillingPostalcode, BillingCountry From Account
Where Account.ID =:Apexpages.currentPage().getParameters().get('id')];
try
{
update updateList;
}
catch(Exception e)
{
System.debug('Exception occurred ' + String.valueOf(e));
}
return null;
}
}
VF:
<apex:page controller="AccountTypeController">
<apex:form >
<apex:outputPanel styleClass="requiredInput" layout="block" id="pwPanel">
<apex:pageBlock title="Filter Accounts" mode="edit">
<apex:pageBlockSection >
<apex:inputfield value="{!filterAccount.Type}" label="Account Type">
<apex:actionSupport event="onchange" action="{!updateRecordList}" rerender="pwPanel"/>
</apex:inputfield>
<br/><br/><br/>
<apex:outputPanel rendered="{!recordList.size > 0}">
<apex:pageBlockTable value="{!recordlist}" var="rl">
<apex:inlineEditSupport showOnEdit="saveButton"
hideOnEdit="editButton" event="ondblclick"/>
<apex:column value="{!rl.Name}"/>
<apex:column value="{!rl.Type}"/>
<apex:column value="{!rl.Website}"/>
<apex:column headerValue="BillingAddress"
value="{!rl.BillingStreet} {!rl.BillingCity}, {!rl.BillingState} {!rl.BillingPostalCode}
{!rl.BillingCountry}"/>
</apex:pageBlockTable>
<apex:commandButton action="{!save}" id="SaveButton" value="Save"/>
</apex:outputPanel>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:outputPanel>
</apex:form>
</apex:page>