Skip to content

Server Connect Form: submit fields and handle the result

Reference · Advanced · App Connect

Submit named form controls, validate user input and react to the returned JSON without a page navigation.

Submit named form controls, validate user input and react to the returned JSON without a page navigation.

  • An App Connect page and an endpoint whose request fields and JSON response shape you know. Use a development endpoint for write examples.

Server Connect Form submits controls to a selected Server Connect action. The form’s input names must match the action’s POST variables. A component ID is used for page bindings; it is not the submitted field name.

Select the form in App Structure. Put a named input and a submit button inside it; do not nest forms.

Control or value Meaning and use
ID / MethodUse a unique ID such as saveForm. POST is appropriate for the example write; GET places fields in the URL and should be used for a read/search workflow.
Select Server Action / Action / Url / SiteSelect the existing action. Action displays its name; Url and Site are maintained by the selector and may be hidden. Choose an action with matching named inputs and output enabled for values the page needs.
CredentialsSets withCredentials for requests that require browser credentials and permits no cross-origin bypass.
Auto SubmitRuns submission after initialization. Leave off when the user must finish or confirm data first. It uses the normal validation/submission path.
Dynamic Prefix / ActionPrefix is prepended to the destination; Action supplies the runtime form URL. Keep destination bindings intentional.
SubmitRuns client validation and the cancelable Submit event before sending. A submit button uses this path.
DirectSkips client validation and the Submit event. It still sends the request; it is not a validation check. Leave false for normal user submissions.
ResetRestores initial control values. Clear Data also aborts the request and clears response state/data; it does not undo a server write.

Example: submit a title and check the returned id

Section titled “Example: submit a title and check the returned id”

Create saveForm with a required text input named title and a submit button. Use a development endpoint accepting title and returning {“record”:{“id”:42,“title”:“Notebook”}}. Enter Notebook and submit. Read saveForm.data.record.id on Success. Bind the button’s disabled state to saveForm.state.executing to discourage duplicate submissions. Keep server validation and record authorization even when the page validates successfully.

Form encoding follows named successful controls, including selected files; disabled controls are omitted. JSON mode turns nonempty number inputs into numbers, supports bracketed names for nested data, and gives checkboxes/radios with explicit values their selected value; without an explicit value the JSON parser uses a boolean. Do not assume changing Post Type leaves the payload shape unchanged. Inspect the request expected by the endpoint.

Handle invalid input at the matching field

Section titled “Handle invalid input at the matching field”

Invalid can occur before any request or after HTTP 400. For server validation, the runtime can map response.form field names to matching [name] controls when the validation extension is loaded. Give users a way to correct each field. A successful response does not automatically clear their input. A later failure preserves previous response data, so do not treat an old id as proof the current submit succeeded.

Use Success for work that depends on a successful JSON response. Done also runs after errors and aborts, so it is suitable for cleanup rather than a saved-successfully message.

Control or value Meaning and use
Start / state.executingA request starts; disable repeated submission or show a loading indicator while executing is true.
Success / dataThe HTTP path accepts status below 400 only when the response parses as JSON. Empty 204 responses and HTML login pages produce a JSON error.
Invalid / Unauthorized / Forbidden / Rate LimitHTTP 400 / 401 / 403 / 429 have distinct event branches. Handle the applicable branch; these do not also trigger the generic Error event.
Error / lastErrorOther HTTP failures, transport failures, timeouts or invalid successful JSON. Inspect status, message and response; do not expose private server details in a public error label.
Abort / DoneAbort ends the browser request. It does not undo work already accepted by the server. Done means the attempt ended.
Upload / DownloadProgress events expose loaded, total and lengthComputable. Progress objects provide position, total and percent. Upload at 100% means bytes were sent; server processing can still fail.

Request options and implementation boundaries

Section titled “Request options and implementation boundaries”

The HTTP timeout attribute is in seconds. The runtime sends an X-CSRF-Token header when a csrf-token meta element is present; the server must still validate it. Upload progress reaching 100% does not mean the server finished processing. Use the normal Submit path for user data. Aborting the browser request cannot guarantee cancellation of a database write already in progress.

Use the related guide to build and check the surrounding page workflow.

You can configure the request, bind its real output and distinguish a successful result from loading, validation and error states.