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.
GATHER STRING LABEL "Enter Full Name" SET ?var
GATHER NUMBER LABEL "Enter Your Age" SET ?age
GATHER DATE LABEL "Pick a Date" SET ?date
GATHER DATE RANGE MIN "2020-01-01" MAX "2025-12-31" LABEL "Pick a Date" SET ?date
GATHER EMAIL LABEL "Enter Email" SET ?email
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.
GATHER STRING LENGTH MIN 3 MAX 10 LABEL "Username" SET ?username
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.
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.
GATHER STRING LABEL "Your Name" SET ?name
AND GATHER EMAIL LABEL "Email Address" SET ?email
AND GATHER NUMBER LABEL "Amount" SET ?amount
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.
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
SET ?approved AS !SESSION('approved')
OR CONFIRM BOOLEAN LABEL "Approve?" SET ?approved
Full Field Type and Constraint Reference
| Form | Description |
|---|---|
GATHER STRING LABEL "..." SET ?var | Collect a text value |
GATHER STRING LENGTH MIN n MAX n LABEL "..." SET ?var | Text with a length constraint |
GATHER NUMBER LABEL "..." SET ?var | Collect a numeric value |
GATHER NUMBER VALUE MIN n MAX n LABEL "..." SET ?var | Number with a range constraint |
GATHER DATE LABEL "..." SET ?var | Collect a date via a native date picker |
GATHER DATE RANGE MIN "date" MAX "date" LABEL "..." SET ?var | Date with a range constraint |
GATHER EMAIL LABEL "..." SET ?var | Collect and validate an email address |
GATHER REGEX "pattern" LABEL "..." SET ?var | Collect a value matching a custom pattern |
CONFIRM BOOLEAN LABEL "..." SET ?var | A yes/no popup, returns true or false |
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.