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
sathishsfdcsathishsfdc 

retain the command button colour change after performing form save and re-render

Hi,
Is there a way to retain the apex:command button colour even after the form is re-rendered
<apex:page standardController="Account">
    <apex:form id="f" >
        <apex:pageBlock title="My Content" mode="edit">
            <apex:pageBlockSection title="My Content Section" columns="2">
                <apex:inputField value="{!account.name}"/>
                <apex:inputField value="{!account.accountNumber}"/>
            </apex:pageBlockSection>
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" onclick="this.style.background='blue';" reRender="f"  value="Save"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
    <apex:outputText>test button colour</apex:outputText>
    </apex:form>
</apex:page>

 and some action like create/update is performed.
When i hit the save buton colour changes and reverts back to the original colour.any possible workaround will be helpful.
 
SalesFORCE_enFORCErSalesFORCE_enFORCEr
On save it will redirect to the detail page. Where do you want to set the color?
sathishsfdcsathishsfdc
Hi,
 I have a detail page code .with account id.. ..this is just that i want to set the colour to be the same after any logic<like updating a field is  performed.
the url will be something like this:
https://c.ap1.visual.force.com/apex/accountdetailpage?id=0019000001CWOzi for the detail page and certain logics are being performed on that
based on command button click
<apex:commandButton action="{!save}" onclick="this.style.background='blue';" reRender="f" value="Save"/>


SalesFORCE_enFORCErSalesFORCE_enFORCEr
Then, you may need to set the button color on page load