How do I create a web form in Scriptable?

There’s no mention in the documentation of anything to trigger this.

The usual browser-based window.close() doesn’t apply to the webview.

There is a discussion about a workaround for programmatic closure, but you would need to pass out the values of the page as one or more parameters to the script (I’d probably try sending the form values as JSON) as you re-run it. But, if you want it to feel more natural, you would just need to put in the effort to apply the approach described in this thread: