When the system is busy working, not to let the user press the button twice or getting confused about the state of his request, we want to disable the button and display the waiting cursor. So we created the following code inside the button:
var btnService = document.getElementsByName("check_lead_contact");
btnService.value='Checking, please wait...';
document.body.style.cursor = 'wait';
document.body.style.cursor = 'default';
However this code does not work, the button does not get disabled and the cursor does not change to "wait". However, if I inspect the code with developer tools, I see that in the console the state of the JS variables linked to both the button and the cursor change but such changes are not reflected in the UI. All the changes in the UI are made once the function ends and not the state variable change, as it is supposed to be, most likely because the call to the webservice somehow make the function hangs.
We asked help to SF support that replied to us that they do not offer support for buttons containing references to either connection.js or integration.js, although they are included in official SF documentation. Does anybody know a way to solve this issue?