Skip to content

TConfirmSubmit: confirm the actions of the controls inside it (#1401) - #1502

Merged
ctrlaltca merged 4 commits into
pradosoft:masterfrom
belisoful:confirm-submit
Nov 9, 2026
Merged

ctrlaltca merged 4 commits into
pradosoft:masterfrom
belisoful:confirm-submit

Conversation

@belisoful

Copy link
Copy Markdown
Member

Part of #1401. Follows #1493.

TConfirmSubmit wraps controls and asks for confirmation in a modal alertdialog before they act. It covers what TConfirmButton cannot, and it needs script: without it, the controls act with no confirmation.

<com:TConfirmSubmit ConfirmText="Delete this record?" ConfirmButtonText="Delete">
	<com:TLinkButton Text="Delete" OnClick="deleteRecord" />
</com:TConfirmSubmit>
User action Controls On Cancel
click links, buttons, image buttons, image map areas the click has no effect
click a checkbox or radio button with AutoPostBack the state stays
change a list or text box with AutoPostBack the value returns

The client control stops the event in a capture listener on the wrapper, and OK sends it again, so validation, postbacks, callbacks, and navigation run through the control's own handlers. This replaces the form submit interception discussed on the issue: it needs no hook in Prado.PostBack or the callback request, and active controls need no special case. A cancelled click leaves a checkbox as it was, with no undo step.

The server passes the client IDs of the visible AutoPostBack descendants, so a plain checkbox or text box in the wrapper does not ask.

TConfirmDialogTrait now holds the dialog properties and rendering, shared with TConfirmButton. TConfirmButton output is unchanged.

Enter in an AutoPostBack text box needed a fix: it opened the dialog during keydown, and the rest of the key press activated the focused Cancel button. The wrapper cancels the key's default action for those fields.

Tests: TConfirmSubmitTest unit tests; confirmsubmit.test.js (vitest); ConfirmSubmitTestCase covers a link button, submit and image buttons, Esc with focus return, an AutoPostBack checkbox, list, and text box with Enter, what does not ask, a callback, validation, and a hyperlink in Chromium, Firefox, and WebKit (repeated 2x without a flake). Image button coordinates after OK are not checked end to end.

@belisoful
belisoful marked this pull request as ready for review November 9, 2026 03:51
@ctrlaltca
ctrlaltca merged commit 8888e8f into pradosoft:master Nov 9, 2026
17 of 18 checks passed
@belisoful
belisoful deleted the confirm-submit branch November 11, 2026 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants