Create a form
Updated
A form is a screen that is not a record card: a picking console, a processing form, a shop-floor terminal. State lives in form attributes, not in a row. Behaviour lives in a C# module. CSS and TypeScript travel with the model.
Note
The cheapest way to create the files is the studio: Developer → Testing & tools → Workspace → Screens (forms), on your model. Live sync writes the envelopes. The script pair is inseparable, like any other script.
How to#
Files under <Model>/Forms/:
| File | What it is |
|---|---|
<Name>.form.json |
Layout plus attributes, moduleScriptMetaId |
<Name>.form.css |
Optional |
<Name>.form.ts |
Optional |
<Name>Form.script.json + <Name>Form.cs |
Module: scriptType: "FormModule" |
Attributes are the form's state (String, Integer, Decimal, Boolean,
DateTime, Guid, Reference, Enum, Table). A Reference or Enum
named from another model needs that model in dependencies.
The platform generates the other half of the class (FormModuleBase, a typed
State). You write OnCreateAsync, OnChangeAsync, and methods marked
[FormCommand]. GetService<T>() works the same as in any script.
Add a menu item that opens the form, and bump
modelVersion.
Tip
nameon a layout node is thedata-zfhook: CSS and the module patch through it. A button'scommandmust match a[FormCommand]method.
The longer contract — events, commands, how the client talks to the module — is Form modules. Examples: Forms: cookbook.
What's not there yet#
A form is not a replacement for a document card. Record editing stays on the generated card (or a designed layout of that card).