GATHER & CONFIRM

GATHER renders a native, centered popup to collect input from the user — the script continues once it is submitted. CONFIRM is the same mechanism specialised to a yes/no decision. Both can be called on their own, simply to collect data, or as the fallback half of an OR.

Bare GATHER — Collecting Data Unprovoked

GATHER does not have to follow an OR. It can be called at any point in a script simply because input is needed right there.

Collect a String
GATHER STRING LABEL "Enter Full Name" SET ?var
Collect a Number
GATHER NUMBER LABEL "Enter Your Age" SET ?age
Collect a Date
GATHER DATE LABEL "Pick a Date" SET ?date
Collect a Date — Range Constraint
GATHER DATE RANGE MIN "2020-01-01" MAX "2025-12-31" LABEL "Pick a Date" SET ?date
Collect an Email
GATHER EMAIL LABEL "Enter Email" SET ?email
Collect a Value Matching a Pattern
GATHER REGEX "^[0-9]{3}-[0-9]{4}$" LABEL "Enter Code" SET ?code

Constraints

Constraints are checked in two places at once: translated to native HTML attributes for immediate in-browser feedback, and independently re-validated by the OcaltQL runtime regardless of what the browser did. If the returned value fails validation, GATHER re-renders the same popup with a visible error message and asks again — this repeats until a valid value is submitted.

String Length Constraint
GATHER STRING LENGTH MIN 3 MAX 10 LABEL "Username" SET ?username
Number Value Constraint
GATHER NUMBER VALUE MIN 1 MAX 999 LABEL "Quantity" SET ?qty

GATHER as an OR Fallback

When used after OR, GATHER only fires if the preceding value is missing entirely, or fails the same constraints declared on the GATHER clause itself. An already-valid existing value skips the popup entirely.

Fallback When Missing
SET ?username AS !SESSION('username')
OR GATHER STRING LENGTH MIN 3 MAX 10 LABEL "Username" SET ?username

AND vs AFTER — Combined vs Sequential Popups

AND and AFTER carry their already-established meanings from everywhere else in OcaltQL. Chaining multiple GATHER statements with AND combines them into one popup, all fields shown together, submitted at once. Chaining with AFTER shows them as separate, sequential popups — the next one only appears once the previous one is submitted.

AND — One Combined Popup
GATHER STRING LABEL "Your Name" SET ?name
AND GATHER EMAIL LABEL "Email Address" SET ?email
AND GATHER NUMBER LABEL "Amount" SET ?amount
AFTER — Separate, Sequential Popups
GATHER STRING LABEL "Your Name" SET ?name
AFTER GATHER EMAIL LABEL "Email Address" SET ?email
(* The email popup only appears once the name popup has been submitted *)

CONFIRM — Yes/No Decisions

CONFIRM BOOLEAN renders a native yes/no popup. Like GATHER, it can be called bare, unprovoked, or used as an OR fallback.

Bare CONFIRM
CONFIRM BOOLEAN LABEL "Approve payment of $" & ?amount & "?" SET ?bool
AFTER IF ?bool IS true
OPEN
  EMIT "Payment approved"
CLOSE
OR
OPEN
  EMIT "Payment rejected"
CLOSE
CONFIRM as an OR Fallback
SET ?approved AS !SESSION('approved')
OR CONFIRM BOOLEAN LABEL "Approve?" SET ?approved

Full Field Type and Constraint Reference

Form Description
GATHER STRING LABEL "..." SET ?varCollect a text value
GATHER STRING LENGTH MIN n MAX n LABEL "..." SET ?varText with a length constraint
GATHER NUMBER LABEL "..." SET ?varCollect a numeric value
GATHER NUMBER VALUE MIN n MAX n LABEL "..." SET ?varNumber with a range constraint
GATHER DATE LABEL "..." SET ?varCollect a date via a native date picker
GATHER DATE RANGE MIN "date" MAX "date" LABEL "..." SET ?varDate with a range constraint
GATHER EMAIL LABEL "..." SET ?varCollect and validate an email address
GATHER REGEX "pattern" LABEL "..." SET ?varCollect a value matching a custom pattern
CONFIRM BOOLEAN LABEL "..." SET ?varA yes/no popup, returns true or false
Site Mode only. GATHER and CONFIRM rely on a real visitor round-trip — rendering a popup, then resubmitting to the same script once answered. The plain credentialed API has no browser round-trip to resubmit against, and no per-visitor identity to match a resubmission to, the same isolation boundary documented on Session & Cookies.