Disable Push Button in Asynchronous way.

KSK

Well Known Member
Hi all,

I have a Push button (“Recalculate Price”) which has a Heavy Code, The approx execution time of “Recalculate Price” push button is 20 seconds.

Issue: users trying to hit the push button for multiple times (say 10 times rapidly) and the application is getting overloaded and hanged for some time (for executing the push button code for 10 times-synchronously).

We want to restrict the user to click ‘Recalculate Price’ multiple times and tried with the below logic.

Recalculate Price (Push button Code)
---------------------------------------------------------------------------------------------------------------
Event Rule –Button Clicked.

Disable Control (Recalculate Price)
Other logic //This logic will take 20 seconds to execute.

Event Rule- Post button clicked
Enable Control (Recalculate Price)
---------------------------------------------------------------------------------------------------------------
Expectation: Once user clicked on “Recalculate Price” .he should wait for 20 sec and not allowed to click the “Recalculate Price” button for 20 seconds (I,e until the first click of entire button code is executed).

Result: Disable Control (Recalculate Price) system function code is not getting executed immediately after the line of execution. In the front end “Recalculate Price” is getting disabled after 20 seconds... So still the user able to click the push button for multiple times.

Please help me on the solution .Thanks in advance.

Thanks,
SivaKumar K
 

DSauve

Legendary Poster
Have you tried moving the "Other logic" that takes 20 seconds into the beginning of the Post Button Clicked event? Then once that's done, enable the control.
 

BOster

Legendary Poster
1. I didn't think a standard push button allowed for any async processing, but maybe TR 9.1.x is different than 8.98 (what I am on) or I don't know how to enable async event for a normal push button...
2. If you don't want async processing then make it synchronous. Users should get an hourglass until processing completes. Shouldn't be a way for them to "queue" up multiple requests.
 

johndanter

Legendary Poster
Remove the users ability to click the button and call it yourself inside ER code

where do the values to calc the price come from? Grid columns or FI fields?

If a grid. Hide the push button and call it yourself in the grid row exited (asynch or inline) or in the OK button and loop etc

If a FI, call it when the user tabs out of the last field variable or have another hidden button called in all of them looking to see when all variables are populated. When they are, that button then calls your hidden calc price button.
Change anyone of the variables and the price is calculated again.
 
Top