+ Start a Discussion

Help: On Save, restrict users from saving again

Hi - I have a VF page with a custom controller. It allows for a multi-line entry of Tasks and when I hit save (command button, save page reference), it does the normal ajax call to run the controller logic and outputs a designated message on the VF page once its done processing. However, in some cases the message doesnt come back quickly, and it seems like users are clicking on the "Save" button multiple times. This is creating duplicate task records. Is there a way to display a message right away while the logic is processing -- similar to the "Waiting Dots" popup in s-controls -- so the users can know not to keep clicking? Or has anyone come up with other creative solutions? tag did not seem to work. 


Thank you in advance!


Best Answer chosen by Admin (Salesforce Developers) 

You could use some AJAX controls such as actionSupport or actionFunction to update the commandButton's disabled attribute. When a user clicks the button, you want to set the disabled attribute to true so the button is greyed out. And then let the apex method operate against the Tasks before re-setting the disabled attribute back to false.