You need to sign in to do that
Don't have an account?
Disable a Custom Button on a Custom object once it has been clicked
Hi,
I have a custom button that sends order information to another system. The button's content Source is a visualforce Page. The visualforce page's controller does the transfer of data by calling a webservice. The vpage then displays the response of the webservice.
The problem we are running into is the users are double clicking the button.
I figured I would disable the button after the first click, but I cannot figure out how to do that. I need the button disabled as soon as the user clicks the button. I can't disable it on the visual force page because to much time has elapsed before the disable will take place. I thought I would try disabling it in the controller but I don't know how to do that.
Can anyone help?
Hello;
If you call your VF page using a Javascript instead of calling your the page directly you can do this.
Here your content Source should be 'Execute JavaScript.'
Code should be as below.
this.disabled = true; //Disable the button this.className = 'btnDisabled';//Apply disabled button style(Optional) window.location='/apex/myVFPage';//Call your VF page
All Answers
Hello;
If you call your VF page using a Javascript instead of calling your the page directly you can do this.
Here your content Source should be 'Execute JavaScript.'
Code should be as below.
this.disabled = true; //Disable the button this.className = 'btnDisabled';//Apply disabled button style(Optional) window.location='/apex/myVFPage';//Call your VF page
As you are using Standard pageLayout for Record [I am assuming.... ],
Also this button is on standard page so yu cant disable it from
We can not enable/disable button based on the some Data field of the record
But we have two work-around for it
1) Try to access
window.opener in your VF page using javascript ,
If you get parent window then you can easilly disable this button
by window.opener.document.getElementById('btnname').disabled=true;
I was not able to get parent window handler
even if you disable button by above way ..... If user refresh the page button again will get enabled :(
2) I will recommend for following approach:
We can toggle page layout based on the record types
define new recordtype for object ------> create new page layout [without button]
Change the record type of record after ..... getting success from webservice in Controller
New page layout get assigned
3)Simplest one
First change your button containt source as "Execute Javascript"
Hope this will help you
Thanks,
Bala
Thanks,
I got the button to disable, and it works functionally the same as it did before i disabled the button.
Hi, prageeth
my requirement is creating visualforce page when i click sumbit button new user should be created. but i need now user enter a values click submit button it will be display on error message.give one example for user object. how to solve the this solution[lease give me any ideas.
I had the same problem. Solved it by making the button a URL.