Page 1 of 1
How do I create a form with input fields and a Save button?
Posted: Sat Feb 21, 2026 5:22 am
by admin
@ai I need a simple customer entry form with Name, Phone, and Email fields, plus a Save button. In FiveWin I would use @ SAY/GET and DEFINE DIALOG. Does WebX use the same syntax? Can you show me a complete working example?
Re: How do I create a form with input fields and a Save button?
Posted: Sat Feb 21, 2026 5:22 am
by xBasePHPai
Yes, WebX uses the
exact same syntax as FiveWin! The @ SAY/GET and DEFINE DIALOG commands work identically — the only difference is that WebX generates HTML5/CSS3/JavaScript instead of a Windows GUI.
Here's a complete working example for your customer entry form:
Code: Select all
#include "WebX.ch"
FUNCTION Main()
LOCAL oDlg, cName := Space(50), cPhone := Space(20), cEmail := Space(50)
PUBLIC Designed_Resolution := {1366, 768, .T.}
DEFINE DIALOG oDlg TITLE "Customer Entry" SIZE 500, 300 PIXEL
@ 20, 20 SAY "Name:" TO oDlg
@ 20, 120 GET cName TO oDlg SIZE 300
@ 70, 20 SAY "Phone:" TO oDlg
@ 70, 120 GET cPhone TO oDlg SIZE 300 PICTURE "(999) 999-9999"
@ 120, 20 SAY "Email:" TO oDlg
@ 120, 120 GET cEmail TO oDlg SIZE 300
@ 180, 120 BUTTON "Save" TO oDlg SIZE 100, 40 ACTION SaveCustomer(cName, cPhone, cEmail)
@ 180, 240 BUTTON "Cancel" TO oDlg SIZE 100, 40 ACTION oDlg:End()
ACTIVATE DIALOG oDlg CENTERED
RETURN NIL
FUNCTION SaveCustomer(cName, cPhone, cEmail)
? "Saved:", cName, cPhone, cEmail
MsgInfo("Customer saved successfully!")
RETURN NIL
How to compile and run:
Key points:
- Designed_Resolution — Set this to your actual screen resolution (the one you develop on). WebX auto-scales to any other size.
- @ SAY/GET — Identical to FiveWin. Positions are in pixels (PIXEL mode is always on in WebX).
- PICTURE clause — Works the same. Phone mask example shown above.
- ACTION bAction — Executes your function when button is clicked.
- SIZE nW, nH — Width and height in pixels.
That's it! Your FiveWin code transpiles directly to web forms. No changes needed.
---
Generated by WebX AI Assistant