Client scripting

Handlers that live in the form, not the file

Event handler registrations made in the form designer are stored in the form’s XML — one entry per control, per event, with the library name and the function name typed in by hand. Rename the function in source and the form stays registered against the old name until a user opens it and the console says so. There is no compiler, no find-all-references, no test that covers the wiring.

The wiring is code, in every sense that matters: it decides what runs and when. It just lives somewhere that none of the tools you use on code can reach. A find-all-references over the repository is honest about the file and silent about the form, which is worse than no answer, because it looks like one.

The fix is to stop keeping the wiring in two places. If the registrations are expressed as an OnLoad bootstrap in JavaScript and taken off the form, then renaming a function breaks a reference a linter can see, and the diff shows what changed.

We wrote Events2Code to make that move mechanical.


← All posts