Disable button on Submit in Modal Dialog

This public forum is for user-to-user discussions of ASP.NET Maker. Note that this is not support forum.
Post Reply
kirondedshem
User
Posts: 642

Disable button on Submit in Modal Dialog

Post by kirondedshem »

I see disable button on submit is already enabled in advanced settings and I can confirm it works well if a from is called from in a NON-modal dialog.

But for modal dialog add, If i accidentally/intentionally double or triple click, I actually end up with more records after the dialog closes.

And the modal dialog form takes a lot of time to disappear, on slow networks Some users might not know that is actually trying to submit so they end up clicking the submit button over and over again, so you can end up with more records.


Webmaster
User
Posts: 9427

Post by Webmaster »

To disable the button after submit in modal dialog, look at and custom the function "ew_ModalDialogShow" (in js/ew.js).


kirondedshem
User
Posts: 642

Post by kirondedshem »

I would want to avoid changing the generated scripts if possible, But i was planning to maybe add an event handler to disable it manually on click, but I have alot of modal dialog forms so I only want to take that path if am sure there is no other way out.

Here is my Proof:
Ive Gone to demo project both in phpmaker and ASP.NET maker
Then onto table "model"->Field settings->Model->Disabled "check duplicate".
Then onto table "model"->table settings->enable modal dialog for add and edit forms.

Then I regenarated both projects.

Case1:Whle in PHPMAKER When i go to models->add dialog and enter content, THEN DOUBLE/TRIPPLE CLICK,I nottice the button is not disabled BUT since the dialog closes too fast I think it does not let me click the second time. Ofourse if the form is NON-MOdal I can see it disable the button.

Case2:Whle in ASP.NET MAKER When i go to models->add dialog and enter content, THEN DOUBLE/TRIPPLE CLICK,I nottice the button is not disabled BUT since the dialog takes a little time before it closes I can manage to click 3 times and see three records inserted. Ofourse is the form is NON-MOdal I can see it disable the button.

SO as you can see in both cases If say a user has a slow network connection he is likely to insert more than one record if he does not know that the dialog if about to close or that its actually trying to process.

Expectation:I was of the view that disable submit button should work on both MODAL and NON-MODAL dialog forms.


Webmaster
User
Posts: 9427

Post by Webmaster »

As you know Modal dialog and normal page are done by different code, a click event handler is attached to the button of the modal dialog to handle the submit. Currently there is no additional code to prevent unexpected user behavior such as repeatedly clicking the button. For the time being you can only add that yourself, for example, by adding your own click event handler using events of the modal dialog, see:
https://getbootstrap.com/docs/3.3/javas ... als-events


Post Reply