Reply
Contributor
RReddy
Posts: 7
0
Accepted Solution

On Clicking Save button, Cancel button also need to go into Saving mode

Hi, I designed a VF page with save and cancel buttons . On Clicking Save button, Cancel button also need to go into Saving mode, similar to Salesforce standard page.

 

My Requirement is :

 

On Clicking Save Button we should disble both Save & Cancel buttons and need to show saving text for both buttons

 

Thanks,

Ramana

RReddy
Regular Contributor
sravan alaparthi
Posts: 15
0

Re: On Clicking Save button, Cancel button also need to go into Saving mode

[ Edited ]

Dear Reddy,

 

if i got it correct u want disable cancel button once Save button is clicked...

 

for this you can rerender the buton's section or panel where your buttons reside when the save button is clicked...

 

Some tips would be:

 

1)Use onclick event for save button

2)reRender the buttons section with attribute disabled is true  for cancel button  

 

Sravan Alaparthi

Salesforce Developer/Adminstrator

Contributor
RReddy
Posts: 7
0

Re: On Clicking Save button, Cancel button also need to go into Saving mode

[ Edited ]

Thanks Sravan,

 

The below code is working for save.but i want to disable cancel and show saving text for both the buttons(Save and Cancel) when i clicked on Save button. 

 

 

<apex:pageBlockButtons location="bottom">

        <apex:actionStatus id="leadActivityTypeStatus">
        <apex:facet name="stop"> 
            <apex:commandButton value="{!$Label.save}" action="{!saveLeadActivityType}" onclick="this.disabled=true;"
                                                    disabled="false" rerender="Form" status="leadActivityTypeStatus"/>
        </apex:facet>
        <apex:facet name="start">
             <apex:commandButton status="leadActivityTypeStatus" value="{!$Label.saving}" disabled="true" />
         </apex:facet>
       </apex:actionStatus>

<apex:CommandButton value="{!$Label.cancel}" action="{!closePanel}"/>

 

</apex:pageBlockButtons>

 

 

Thanks

Ramana

RReddy
Trusted Contributor
vishal@force
Posts: 427
0

Re: On Clicking Save button, Cancel button also need to go into Saving mode

Try this, it will disable both the buttons and it will show the text as 'saving...' on both of them.

 

 

<apex:pageBlock >
            <apex:commandButton value="Save" id="save" action="{!save}" onclick="saving('start', this, '{!$Component.cancel}');" oncomplete="saving('stop', this, '{!$Component.cancel}');"/>
            <apex:commandButton value="Cancel" id="cancel" action="{!cancel}" />
                <script>
                    function saving(activity, obj, id)
                    {
                         if(activity == 'start'){
                             obj.value = 'saving...';
                             obj.disabled=true;
                             document.getElementById(id).value = 'saving...';
                             document.getElementById(id).disabled = true;
                         }
                         else{
                             obj.value = 'save';
                             obj.disabled=false;
                             document.getElementById(id).value = 'cancel';
                             document.getElementById(id).disabled = false;
                         }
                        
                    }
                </script>
 </apex:pageBlock>

Vishal, Certified Developer and Administrator
Kudos a post if it helps, mark it as solution if it solves.
http://exploretheforce.blogspot.in
Visitor
ram.svkp@gmail.com
Posts: 1
0

Re: On Clicking Save button, Cancel button also need to go into Saving mode

Thank you Vishal...You did a gr8 job..Its working for me.