function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
div ninediv 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>
Steven NsubugaSteven Nsubuga
action should be save, not update.
<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="{!save}"/>


</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>


 
Ajay K DubediAjay K Dubedi
Hi Div,

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
div ninediv nine
Thanks guys for help