Skip to content

Upgrades JS CallbackControl.onPostback - better logging on exception - #1253

Merged
ctrlaltca merged 1 commit into
pradosoft:masterfrom
belisoful:js-postback-logger
Aug 31, 2026
Merged

Upgrades JS CallbackControl.onPostback - better logging on exception#1253
ctrlaltca merged 1 commit into
pradosoft:masterfrom
belisoful:js-postback-logger

Conversation

@belisoful

Copy link
Copy Markdown
Member

Callback dispatch: log on failure, fall back to the default action

CallbackControl.onPostBack (and TActiveImageButton) previously called dispatch() then preventDefault(). If dispatch() threw — typically from a ClientSide hook — preventDefault() never ran, so the failure was silent and the click still fell through to a postback.

Now the dispatch is wrapped: on throw, the error is logged via Logger.error and rethrown, and preventDefault() is deliberately skipped so a submit button degrades to a full-page postback instead of dead-ending. TActiveImageButton keeps its x/y coordinate inputs on failure so the fallback submit carries the click position.

JS-only; no PHP change. Adds unit coverage in activecontrols.test.js and a functional spec (TActiveButtonPostBackFallbackTestCase).

@belisoful
belisoful marked this pull request as ready for review August 30, 2026 05:54
@belisoful

Copy link
Copy Markdown
Member Author

The Agents identified that if there is an exception, that "preventDefault" is not called and falls back to posting the page. Any exception is written to the JS log as a matter of the browser function... but it would immediately be erased by the post response. Any intrinsically logged exceptions are unknown and unrecoverable.

This PR makes the logging of the exception deliberate and known.

The agents recommended rearranging the order of operation, but after considering the pros and cons, the way it is works but needs better exception handling.

@ctrlaltca
ctrlaltca merged commit fc548d6 into pradosoft:master Aug 31, 2026
17 checks passed
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