Fill in a form in the browser - #5
Merged
Merged
Conversation
A form is the one thing in a PDF meant to be changed by whoever receives it, and the one thing every other verb in this workbench would destroy: rotating a page or laying two on a sheet rebuilds the document, and a form is tied into a document by object number in a dozen places at once. So a form is filled in on the file itself. What was opened is kept, the values go into it, and what is saved is that file with the answers appended after it — which is how everything that saves a form saves one, and which means a form saved here is still a form. The panel is built out of the toolkit's own widgets and nothing else: a box to type in, a square to tick, a list to choose from, and a plain label for a field the document says may not be changed — shown all the same, so somebody can read what it holds and see why they cannot type in it. Each is bound to its field through the observable the widget already publishes, so nothing is copied back and forth every frame; a change arrives when it happens. The tests drive the widgets rather than the setters behind them. Calling Field.SetText from a test proves the setter works and says nothing about whether anything is wired to it — and the first version of these tests did exactly that, and passed while three of the bindings were never once executed.
tannevaled
added a commit
that referenced
this pull request
Aug 27, 2026
A form is the one thing in a PDF meant to be changed by whoever receives it, and the one thing every other verb in this workbench would destroy: rotating a page or laying two on a sheet rebuilds the document, and a form is tied into a document by object number in a dozen places at once. So a form is filled in on the file itself. What was opened is kept, the values go into it, and what is saved is that file with the answers appended after it — which is how everything that saves a form saves one, and which means a form saved here is still a form. The panel is built out of the toolkit's own widgets and nothing else: a box to type in, a square to tick, a list to choose from, and a plain label for a field the document says may not be changed — shown all the same, so somebody can read what it holds and see why they cannot type in it. Each is bound to its field through the observable the widget already publishes, so nothing is copied back and forth every frame; a change arrives when it happens. The tests drive the widgets rather than the setters behind them. Calling Field.SetText from a test proves the setter works and says nothing about whether anything is wired to it — and the first version of these tests did exactly that, and passed while three of the bindings were never once executed. Co-authored-by: David Delavennat <david.delavennat@free.fr>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A form is the one thing in a PDF meant to be changed by whoever receives it — and the one thing every other verb in this workbench would destroy, since rotating a page or laying two on a sheet rebuilds the document and a form is tied into one by object number in a dozen places at once.
So a form is filled in on the file itself: what was opened is kept, the values go into it, and what is saved is that file with the answers appended. A form saved here is still a form.
Built from the toolkit, nothing hand-drawn
Entryfor a text field,CheckButtonfor a checkbox or a button,DropDownfor a choice field,FormFieldfor the label,ScrollViewfor a form longer than the window. A field the document locks is shown as a plain label — so somebody can read what it holds and see why they cannot type in it.Each is bound to its field through the observable the widget already publishes. Nothing is copied per frame.
What the tests taught me
The first version of these tests called
Field.SetTextdirectly and passed — while three of the bindings had never once been executed. Coverage said so; the assertions did not.They now dig the real widget out of the row and drive that:
Which is the difference between proving the setter works and proving anything is wired to it.
100% statement coverage,
go vetclean,js/wasmbuilds.