You need to sign in to do that
Don't have an account?
div nine
hi can any body help me correct this code. Thanks(I want to update not save but salesforce is not letting me)
I want to update not save but salesforce is not letting me
<apex:page standardController="Onboarding__c" >
<apex:form >
<apex:pageBlock >
<apex:pageblockSection title="Information" >
<apex:inputField value="{!Onboarding__c.termination1__c}"/><br></br>
<apex:inputField value="{!onboarding__c.employed__c }"/>
</apex:pageblockSection>
<apex:pageBlockButtons >
<apex:commandButton value="save" action="{!update}"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
<apex:page standardController="Onboarding__c" >
<apex:form >
<apex:pageBlock >
<apex:pageblockSection title="Information" >
<apex:inputField value="{!Onboarding__c.termination1__c}"/><br></br>
<apex:inputField value="{!onboarding__c.employed__c }"/>
</apex:pageblockSection>
<apex:pageBlockButtons >
<apex:commandButton value="save" action="{!update}"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
Please refer the below code snippet. Hope it helps you.
// VF Page
<apex:page controller="NewAccountDiscription">
<apex:form id="theForm">
<apex:pageBlock id="thePBlock">
<apex:pageBlockSection id="accountRecordSection">
<apex:repeat value="{!AccountList}" var="acc">
<apex:inputtextarea style="resize:none" id="thetextArea" value="{!acc.Description}"/>
</apex:repeat>
</apex:pageBlockSection>
<apex:pageBlockButtons location="bottom">
<apex:commandButton value="Save" action="{!onSave}" />
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
// APEX Controller
public class NewAccountDiscription {
public List<Account> AccountList{get;set;}
public Boolean setEdit{get;set;}
public NewAccountDiscription()
{
AccountList = new List<Account>();
AccountList = [SELECT Name,Description FROM Account LIMIT 1];
system.debug('AccountList-->'+AccountList);
}
public PageReference onSave()
{
List<Account> updateAccountList = new List<Account>();
for(Account accloop: AccountList)
{
Account accountObject = new Account();
accountObject.Id = accloop.Id;
accountObject.Description = accloop.Description;
updateAccountList.add(accloop);
}
update updateAccountList;
PageReference pageRef = new PageReference('/apex/NewTestpageVF'); //Here in place of "NewTestpageVF" you need to pass your VF page name.
pageRef.setRedirect(true);
return pageRef;
}
}
Please select as best answer if it helps you.
Thank You,
Ajay Dubedi