Developers · Forms
Form Server-Side Processing
Last updated 7 November 2026
This topic explains server-side processing when users submit a form in Insites.
Prerequisites
Comprehending this subject requires a prior understanding of the following topics:
1. CSRF Token validation
The first thing that occurs before every POST request is a CSRF token validation. The system does not proceed with the user's session if it is not provided.
Important
For AJAX calls, provide the following headers:
If you use the
2. Find the form based on the 'form_name' or 'form_id' parameter
The system then tries to identify the form that processes the user's request. To do so, the server checks for the
3. Check permissions
The next step is authorization using Permissions. These are processed in the order they were defined - from top to bottom. If the authorization fails, the server stops processing the form and handles authorization policy failure (usually via a redirect or rendering '403' error).
4. Resource Owner authorization
Once all authorization policies pass, the next item to be checked is an authorization for the resource_owner property. It checks if the currently logged-in user can access the resource with the given
Note
Resource Owner is only relevant for 'update' or 'delete' operations. It is irrelevant for the 'create' operation, as no resource is available during that time.
5. Modifying the user input using 'default_payload' JSON
The next step is to extend or overwrite the user's input with
6. Validating the user input
The result of merging the user's input with
7. Calculating changes
If validation passes, the changeset between the existing state of the resource and user input is calculated and made accessible via the
8. Persisting changes
The resource's new state persists in the database. In the case of the rare scenario of an internal server error, the changes are rolled back, and the server renders a '500' error.
9. Processing callbacks
The next step is to process the callback synchronously.
10. Schedule processing 'AsyncCallback' processes
The system then schedules asynchronous callback processes in the background.
11. Schedule sending notifications
The next step is to schedule all notifications (email, SMS, API calls) to be processed in the background.
12. Rendering a response
If the format is set to HTML, the
Note
It is possible to send a request via AJAX but receive an HTML response from the server. The trick is explicitly setting the HTML format by appending
The server will render HTML if validation fails (so you could display errors) or return a JSON, including a redirect URL upon success.