Initialize Form And Continue Execution
Audience:
Low-code EngineersSkill Prerequisites:
Actions,Forms,Tokens
Loads a Form module on the current page, in place, then carries on with the next actions. It's available in forms and listings.
The page isn't refreshed. The form is loaded from the server again, so its fields start over with their initial values and its On Preinit and On Init actions run again. A common setup is to set the form's Display Mode to Manual, so it doesn't load with the page and this action loads it when it's needed. See Display Mode.
| Action | What happens after the form is initialized |
|---|---|
| Initialize Form And Stop Execution | No further actions run. |
| Initialize Form And Continue Execution | The form is loaded right away and the next actions keep running. |
Typical Use Cases
- Load a second form on the page, and keep going, for example to show a message or save data
- Reset a form after it's been submitted, and still run the rest of the actions
- Load several forms on the page from one button, one action for each form
Don't use it to
- Load a form and stop. Use Initialize Form And Stop Execution instead.
- Open a form in a popup. Use Open Form Popup And Continue Execution instead.
- Load a form that's on another page. Use Redirect To Url instead.
- Pass values that the actions after it produce. The form is loaded with the values known when this action runs.
Related Actions
| Action Name | Description |
|---|---|
| Initialize Form And Stop Execution | Loads the same form and ends execution. |
| Open Form Popup And Continue Execution | Opens a form in a popup and keeps running the next actions. |
| Open Form Popup And Stop Execution | Opens a form in a popup and ends execution. |
| Execute Javascript Code And Continue Execution | Runs your own JavaScript in the browser, for example to call dnnsf.api.actionForm.initForm yourself. |
| Refresh Listing | Reloads a listing on the page. |
Input Parameter Reference
| Parameter | Description | Supports Tokens | Default | Required |
|---|---|---|---|---|
| Select Module | The Form module to initialize. The list shows the Form modules on the site, as Title (#ModuleId). Click EXPR to enter a module ID, such as 1234, or a token that holds one. The module's unique ID (a GUID) also works. The action fails if it's empty or doesn't match a module. | Yes | empty string | Yes |
| QueryString Parameters | Name and value pairs sent to the form when it loads. The form reads them as [QueryString:Name] tokens in its On Preinit and On Init actions. Tokens in both the names and the values are replaced before they're sent. If a name is used twice, the last one wins. | Yes | empty | No |
How the form is initialized
- It runs in the browser. The action sends a small script to the browser as soon as it runs. The script calls
dnnsf.api.actionForm.initForm(moduleId, parameters), which asks the server for the form and puts it in place of the old one. Meanwhile, the server keeps running the remaining actions. - The form starts over. Anything the user typed in it is lost. Fields get their initial values, and
On PreinitandOn Initrun again.On Page Loaddoesn't run again. - Passing values. The form gets the query string of the current page plus the QueryString Parameters. If a name is already in the page's query string, the action's value wins.
Considerations
- The form must be on the page. The list offers every Form module on the site. If the chosen form isn't on the current page, nothing loads and the browser console shows an error.
- Not in
On Page Load,On PreinitorOn Init. The action isn't offered in those form events. Use Initialize Form And Stop Execution there, or run it from a button. - Later actions can undo it. A redirect or a page refresh after this action replaces the page, form included.
- Conditions. To load the form only in some cases, give it a condition, for example
"[Status]" == "Saved". See Common Parameters. - Not in APIs or workflows. The action runs JavaScript in the browser, so it's only available in forms and listings.
- Same as the JavaScript API. In your own code,
dnnsf.api.actionForm.initForm(1234)does the same, anddnnsf.api.actionForm.initForm(1234, { OrderId: 5 })also passes values.
In Listings
Listings also have Initialize Form, a client-side version of this action. It's only available on buttons with Client Button turned on. It runs in the browser as soon as the button is clicked, without a request to the server.
It has the same parameters as this action. The differences:
- Tokens are replaced when the listing loads, not when the button is clicked. On an item button, that's when the row is shown, so the row's values, such as
[Id], are available. On a root button, only values that don't depend on a row are. - The condition is checked when the listing loads too.
- There's no Stop or Continue. A client button only runs client-side actions, one after another.
Examples
To understand how to use the below examples, please see Running Examples.
1. Show a customer's orders after saving the customer
Add this action to the submit button of a customer form, after the action that saves the customer. It loads the orders form, module 1234, on the same page and passes the new CustomerId. The next actions, such as a toast message, still run.
{
"Title": "Initialize Form And Continue Execution",
"ActionType": "InitActionFormAndContinue",
"Description": "Load the orders form for the saved customer",
"Parameters": {
"ModuleId": "1234",
"Params": [
{
"name": "CustomerId",
"value": "[CustomerId]"
}
]
}
}
2. Load a form picked by a token
This action loads the Form module whose ID is in the DetailFormId token, only when DetailFormId isn't empty.
{
"Title": "Initialize Form And Continue Execution",
"ActionType": "InitActionFormAndContinue",
"Description": "Load the detail form",
"Condition": "\"[DetailFormId]\" != \"\"",
"Parameters": {
"ModuleId": "[DetailFormId]",
"Params": []
}
}
Revised 09/27/2026