Page 1 of 1

Risk of loosing data on slow pageload

Posted: 2014-11-30 18:53
by casjazz
I have a detailview page with 14 dropdowns.
If the page loads slow (2-6 sec), the user has time to update the record before all values at loaded. The not loaded dropdowns will overwrite existing values with empty values.
Rigth now i have a script almost in the end of the _dml.php file, that activates the buttons after 1500-4500 ms. but if the page take longer to load I still have the problem.

Does anyone have an idea how to either get the selects to load faster or how to make sure that the user can't update the record before all select2() are loaded ?

Image

Re: Risk of loosing data on slow pageload

Posted: 2014-12-01 21:52
by a.gneady
Thanks for taking the time to report this bug ... We'll make sure to fix it in the next release. For now, here is a work-around to disable the update/save new buttons during data loading: Add the following code to the file "hooks/tablename-dv.js" (where tablename is the name of the concerned table) .. you should create the file if it doesn't exist:

Code: Select all

$j(function(){
    $j(document).ajaxStart(function(){ $j('#update, #insert').prop('disabled', true); });
    $j(document).ajaxStop(function(){ $j('#update, #insert').prop('disabled', false); });
});

Re: Risk of loosing data on slow pageload

Posted: 2014-12-02 07:45
by casjazz
Thank you so much - you've just saved my day :)
I've been strugglign with this for weeks, and in two hours i'm going to present my website, now without any (known) trouble :-)

Re: Risk of loosing data on slow pageload

Posted: 2016-03-30 11:10
by AhmedBR
Hi,

Was this added in a newer release, or we still have to use this trick?

Thanks and have a nice day ;)

Re: Risk of loosing data on slow pageload

Posted: 2016-03-31 12:13
by a.gneady
Yes, it was added in recent releases. No need to add this code manually.

Re: Risk of loosing data on slow pageload

Posted: 2016-04-01 23:50
by AhmedBR
Thanks.