Skip to main content
Version: 1.0.8

Form

A container that collects its child inputs and submits them to a database through a write named query. Validation, submission and the success/error outcome are handled for you — the result arrives as submitSuccess or submitError rather than as a script you have to write.

The Form component as it renders with its default settings.The Form component as it renders with its default settings.

Reach for it when you need:

  • Downtime and defect entry
  • Batch records and quality checks
  • Any structured data entry that lands in SQL

Component name: Form · Category: Input

In the palette: Collect inputs and submit them to a database via a write Named Query

Properties​

Any property can be bound to a tag, another component's property, or a query.

PropertyTypeDefaultDescription
sizeenuminheritHeight, padding and text of every field in this form (and its Submit button). Project default = the project's Control size (Project settings → Theme). Use md or larger on touch panels. Options: inherit · xs · sm · md · lg · xl. 1.0.8
headerobject{"title":"","subtitle":"","align":"left","divider":false,"ba… (truncated)Optional header block above the fields: title + subtitle text, alignment, a divider line, and its own background / spacing / text styling. Leave title and subtitle blank = no header.
  ↳ header.titlestring""Heading text. Blank = no title line.
  ↳ header.subtitlestring""Descriptive line under the title. Blank = none.
  ↳ header.alignenumleftAlign the title + subtitle: left, center, or right. Options: left · center · right.
  ↳ header.dividerbooleanfalseDraw a divider line between the header and the form fields.
  ↳ header.backgroundcolor""Header background color. Blank = transparent.
  ↳ header.paddingnumber12Inner padding (px) around the header content.
  ↳ header.marginnumber0Outer margin (px) around the header block.
  ↳ header.titleSizenumber16Title font size (px).
  ↳ header.titleWeightenumsemiboldTitle font weight. Options: normal · medium · semibold · bold.
  ↳ header.titleColorcolor""Title text color. Blank = theme default.
  ↳ header.subtitleSizenumber12Subtitle font size (px).
  ↳ header.subtitleColorcolor""Subtitle text color. Blank = muted theme default.
autoHeightbooleantrueAuto-grow the form's HEIGHT (header + fields) so nothing clips when fields stack on mobile/narrow widths — works in Coordinate, Flex and Grid. Width is unaffected. Turn off for a fixed-height box you size by hand (the field area then scrolls).
insertQueryenum""The INSERT (write-type) Named Query this form submits — its :params become the fields. Also used in edit mode when no updateQuery is set (e.g. an upsert).
updateQueryenum""Edit mode: the write-type Named Query run when recordId is set (UPDATE … WHERE :recordKey). Blank = use insertQuery for both insert and edit (e.g. an upsert).
selectQueryenum""Edit mode: the SELECT (read-type) Named Query that fetches the row to edit by its key (SELECT … WHERE :recordKey). Its columns seed the fields (column name = field param).
recordFromTableenum""Convenience (SAME view): pick a Table on this view → recordId is auto-bound to its selected row's key, making this Form the editor for that table's selection. It just sets recordId for you (you can still edit recordId by hand).
recordFromParamstring""Convenience (DIALOG / other view): the name of the view Param that carries the record id (passed by the Panel action that opens this Form, e.g. params: { id: row.id }). Auto-binds recordId to {{params.<this>}}. Use recordFromTable instead when the Table is on the same view.
recordIdstring""The key value of the row to edit (bind to a selected table row / tag / param). Empty = insert mode (new row).
recordKeystringidThe key column / param name used by selectQuery and updateQuery (e.g. 'id').
resetAfterbooleanfalseClear the fields after a successful insert (ignored in edit mode)
stylestyle{}Custom CSS properties

Events​

Attach event actions to these in the Event Manager.

EventLabelGroupPayload
clickClickMouseThe DOM event.
dblclickDouble clickMouseThe DOM event.
contextmenuRight clickMouseThe DOM event.
mouseenterMouse enterMouseThe DOM event.
mouseleaveMouse leaveMouseThe DOM event.
changeChangeInputThe DOM event.
submitSubmitInputThe DOM event.
focusFocusInputThe DOM event.
blurBlurInputThe DOM event.
submitSuccessSubmit successFormcontext.submit — the submitted values.
submitErrorSubmit errorFormerror (bare) plus context.submit.
Right-click behaves differently in the Designer

contextmenu fires your configured actions at runtime only — in LiveView and in preview. On the Designer canvas the right-click is captured to open the Event Manager, so testing it there will not run your actions. Test right-click in preview.

Notes​

Submitting through a named query rather than inline SQL keeps the statement in one place, binds parameters instead of concatenating them, and lets the screen work without database credentials of its own.

Two field fixes in 1.0.7: Changed in 1.0.7 a field's clearable now works on number and password fields, where it saved but drew nothing; and a wysiwyg field is resizable from a 180-pixel minimum and no longer offers the person filling the form a switch to Markdown source — see WYSIWYG.

What the outcome events hand a script​

submitSuccess carries the submitted values as context.submit. submitError carries the error as a bare error, and the values as context.submit too, so a handler can tell the operator which record failed. The Event Manager shows this under each event. New in 1.0.8

Every field on one size New in 1.0.8​

The form's fields used to draw at a fixed 44 px with small text, whatever else was on the screen. They now follow the same scale as the field widgets — xs 28 · sm 36 · md 44 · lg 52 · xl 64 px — and the form's size sets it for every field and the Submit button at once. Project default follows the project's Control size. A select field is exactly as tall as a text field beside it at every size.

A select field whose options come from a named query fetches them again each time the form opens, rather than reusing a 30-second-old copy. Changed in 1.0.8

Fields, buttons and menus draw smaller after upgrading to 1.0.8

Before 1.0.8 these widgets had one size, what is now md (a 44 px field). The project's Control size defaults to sm (36 px), sized for desktop dashboards, and every widget whose size is Project default follows it — which is every widget in an upgraded project. On a touch panel, set Project settings → Theme → Control size to md or larger: 44 px is the touch-target minimum.

See also​