on web action
This block is part of the web group and was last modified in core v15.0.1.
on web action v15.0.1 Runs when a button or form on a web page of this blueprint calls the action with this name (data-action="name"). Answer with web replace, web remove, web insert, web update, web errors or web redirect: only those parts of the page change.
- flow
- connection
httpconnection - form
objectThe fields the form or button sent.
- key
valueThe data-key of the element the action came from: which row was clicked.
- params
object - query
object - language
value
Entry block of a web action, named by its `event` field. It is reached ONLY by a POST to a URL of a web_page in the same blueprint whose body carries `_action=<event>`. Admission: the posted page's scopes, AND the action's own `scopes` when it has any, else the scopes of EVERY web_page in the blueprint (a blueprint with a public and an admin page needs `scopes: ["*public"]` on an action the public page uses). A cross-site POST is refused. The browser runtime sends it for `<button data-action="name">`, `<form data-action="name">` and `<input data-action="name" data-trigger="input">`; a plain HTML form works too (`<input type=hidden name=_action value=name>`). Out-pins: form (object of the posted fields; a repeated name or a name ending in [] is an array; `_action` and `_key` removed), key (the data-key of the element closest to the button, i.e. which row was clicked; "" when none), connection, params, query, language. The flow answers by adding browser updates with web_replace/web_update/web_insert/web_remove/web_errors/web_redirect; they apply in order. A web_render here answers with a whole new page instead. No updates at all answers an empty update list (the page stays as it is). Without JavaScript the visitor is redirected back to the page (303) or to web_redirect's URL.
button click |
form submit |
web form |
on click |
on web action runs when a button or form on a web page of this blueprint calls it by the name in its event setting. The posted fields arrive on form, and key says which row was clicked: the data-key of the element closest to the button. get fields and set fields turn the form into mutations, update document writes them to the document with that guid, web template renders the row again and web replace swaps it in. Only that row changes in the browser. An action with no update blocks leaves the page as it is.
Used in these guides
These documentation pages use or explain this block:
- Building a Dashboard with Charts
- Building a Login Page
- Building User Authentication
- Email System Setup
- File Upload & Processing
- Common Blueprint Patterns
- How Web Pages Work
- Languages
Version history
Introduced in v15.0.1.
v15.0.1: block added in this release.
Back to
web Return to the main group to view all sub-groups Back to web pages Return to the group to view all blocks within this group 