disable save until loaded

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
andyrav
User
Posts: 641

disable save until loaded

Post by andyrav »

Hi
I have a Form with a lot of selects about 30 and 10 of the using table lookups.
if someone edits record quickly saves it before the page has finished populating the dropdown boxes the data from the select boxes it removed.

is there anyway to stop this from happening?
ie disable save untill loaded

many thanks


mobhar
User
Posts: 11727

Post by mobhar »

They should not be able to change the value, because in the latest minor version of v2019, system will display the cursor style in "wait" mode while loading the values of lookup fields on the form. This cursor style will be back again to "default" mode after all the values in those lookup fields have been completed loaded.

However, you may enhance this by customizing the "setCursor" function in the "ewp.js" template file; for example by disabling also the submit button while the cursor in "wait" mode; and then enable it when the cursor mouse in "default" mode.

Please read "Customizing Template" topic from PHPMaker Help menu for more info how to customize the template files.


andyrav
User
Posts: 641

Post by andyrav »

Thanks do you need to enable the wait function?
Is there any way to double check this is working
I have running the latest version 2019.0.9, and i don't see the cursor style change.
is this the same when in grid edit mode?


mobhar
User
Posts: 11727

Post by mobhar »

andyrav wrote:
Thanks do you need to enable the wait function?

No, it already exists by default in the Javascript Framework that used by PHPMaker. Since version 2019.0.8, it has been improved. For more info, please see this change log: http://www.hkvforums.com/viewtopic.php?f=4&t=42665.


andyrav
User
Posts: 641

Post by andyrav »

Hi
Just installed 2019.0.10 and on loading my courser does not change to wait, it is always the standard pointer.
any ideas? even tried on the demo file

thanks


mobhar
User
Posts: 11727

Post by mobhar »

Try to enable/disable the "Use modal dialog for lookup" option in order to see the effect.


arbei
User
Posts: 9388

Post by arbei »

You can use jQuery to disable the save button in Startup Script and re-enable it when Ajax stops. You can use the jQuery's ajaxStop method, see https://api.jquery.com/ajaxStop.


andyrav
User
Posts: 641

Post by andyrav »

Thanks none of my dropdowns are modal so would not work, be nice if the "Set cursor of target element to "wait" during Ajax lookup" was also some how a option to enable on enable on the whole page

my workaround was

$('#btn-action').attr("disabled", true);
$(document).on("updatedone", function(e, args) {
$('#btn-action').attr("disabled", true);
});
$( document ).ajaxStop(function() {
$('#btn-action').attr("disabled", false);
});

Is this the correct way to do?
Thanks


arbei
User
Posts: 9388

Post by arbei »

Why disable the button if update done?


andyrav
User
Posts: 641

Post by andyrav »

Hi
My page takes about 4 seconds for all the dropdowns to populate so stays disables untill all ajax request are finished.


arbei
User
Posts: 9388

Post by arbei »

You already did it.

andyrav wrote:
$('#btn-action').attr("disabled", true);


Post Reply