# Membership Survey — exercises every field type, validation, colors,
# locked fields, form-level DEF defaults, and pre/post-form commands.
#
#   Run:  python3 fedform.py examples/survey.def
#         python3 fedform.py examples/survey.def -o shell
#         python3 fedform.py examples/survey.def --values examples/survey-values.json
#
# Tab / Shift-Tab navigate, F10 submits, ESC cancels.

# Form-wide color defaults (any field may override these).
DEF SAY    cyan,default
DEF COLOR  white,default
DEF FOCUS  bright-white,blue
DEF SELECT bright-yellow,red

# Pre-form commands: save the screen, then clear it.
PUSH
CLS

@1,18 SAY "=== Membership Survey ==="

# --- Left column: text, mask, and locked fields ---
@3,2  SAY "Name:"
@3,14 GET name LINE 24 60 --required

@5,2  SAY "Email:"
@5,14 GET email LINE 24 120 --regex "^[^@]+@[^@]+\.[^@]+$"

@7,2  SAY "Phone:"
@7,14 GET phone MASK phone:classic --required

@9,2  SAY "Age:"
@9,14 GET age MASK int:3 --range 18:120

@11,2 SAY "Acct #:"
@11,14 GET acct LINE 10 10 -v "100042" LOCKED

@13,2 SAY "Notes:"
@13,14 GET notes AREA 24 3 500 1 1

# --- Right column: list, radio, and checkbox groups ---
@3,44 SAY "Department:"
@4,44 GET dept LIST 18 4 -i "Sales|Support|Engineering|Finance" --required

@9,44  SAY "Plan:"
@10,44 GET plan RADIO 18 -i "Free|Pro|Enterprise" -v "Pro"

@14,44 SAY "Interests:"
@15,44 GET interests CHECK 22 -i "Sports|Music|Travel|Reading"

@20,2 SAY "Tab: next | Shift-Tab: prev | F10: submit | ESC: cancel"

# Post-form command: park the cursor, then restore the saved screen.
CURSOR 22,0
POP
