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
Ken KoellnerKen Koellner 

Second button press while transfering data causes error because contructor called with no arguments.

I have a weird problem on a VF page.  There's some buttons that query for data that take a while.  For about 10-15 seconds, the browser status line ways "Waiting for".  Then for 5-10 seconds the status line says "Transferring data from".  If  I press another button on the page while this transferring data is going on, I get an error.  The request somehow calls the page's controller constructor again without some needed parameters, and then the controller throws a message because the data isn't available?


Anyone else experience this?  It's quite annoying.  I don't want to tell my uses "hands off the keyboard while the page is loading."  They'll never get it right.


My guess is that during the data transfer part, the view state hasn't yet been copied to the browser.  So pressing another button makes another request for the page with no view state so it tries to serve it from scratch.  Not sure what to do about.


By the way, I did try using apex:actionFunction and rerender which does an AJAX request but in this case there's a log of data and I got horrid performance.  It took five to seven times as long to load the same amount of data.




You could use JQuery to disable all buttons on the page. This isn't future proof, but it looks like salesforce uses a class called "btn" on their buttons. The jQuery would look like this (put this at the bottom of your page just above the </apex:page> tag:


<script language="javascript">
	$('.btn').on('click', function() {


 You'll need to include the jQuery reference at the top of your page somewhere inside the <apex:page> tags and before the above function.


<script language="javascript" src=""></script>


I'm not sure what actions you have that can "undo" the effects of the jQuery, but you'd use this to do it:



 I hope this helps.