Skip to main content
Version: 1.28 (Current)

Initialize Form And Stop Execution

Audience: Low-code Engineers

Skill Prerequisites: Actions, Forms, Tokens

Loads a Form module on the current page, in place, then stops. No further actions run. 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.

ActionWhat happens after the form is initialized
Initialize Form And Stop ExecutionNo further actions run.
Initialize Form And Continue ExecutionThe form is loaded right away and the next actions keep running.

Typical Use Cases​

  • Load a form that's hidden when the page opens, only when the user needs it, so the page loads faster
  • Reset a form after it's been submitted, so the user can enter another record
  • Reload a form with different values, such as the record picked in another form or a listing row

Don't use it to​

Action NameDescription
Initialize Form And Continue ExecutionLoads the same form and keeps running the next actions.
Open Form Popup And Stop ExecutionOpens a form in a popup and ends execution.
Open Form Popup And Continue ExecutionOpens a form in a popup and keeps running the next actions.
Execute Javascript Code And Stop ExecutionRuns your own JavaScript in the browser, for example to call dnnsf.api.actionForm.initForm yourself.
Stop ExecutionStops running actions without loading anything.

Input Parameter Reference​

ParameterDescriptionSupports TokensDefaultRequired
Select ModuleThe 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.Yesempty stringYes
QueryString ParametersName 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.YesemptyNo

How the form is initialized​

  • It runs in the browser. The action sends a small script to the browser. 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.
  • The form starts over. Anything the user typed in it is lost. Fields get their initial values, and On Preinit and On Init run again. On Page Load doesn'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.
  • Final action. Actions placed after it in the same list never run, unless its condition is false. Use the action's Condition to decide when to run it, for example "[Status]" == "Saved". See Common Parameters.
  • Don't initialize a form from its own On Init. Initializing the form runs On Init again, which would initialize it again.
  • Not in On Page Load. Those actions run while the page is being built, before there's a form to load. The action has no effect there.
  • 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, and dnnsf.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​

tip

To understand how to use the below examples, please see Running Examples.

1. Load an order form for a listing row​

Add this action to an item button in a listing. It loads Form module 1234 on the same page and passes the row's OrderId. In the form's On Init actions, [QueryString:OrderId] holds the ID.

{
"Title": "Initialize Form And Stop Execution",
"ActionType": "InitActionForm",
"Description": "Load the order form for this row",
"Parameters": {
"ModuleId": "1234",
"Params": [
{
"name": "OrderId",
"value": "[OrderId]"
}
]
}
}

2. Reset a form after it's saved​

Add this action at the end of a form's submit button. When the Saved token is true, it loads the same form again, empty, so the user can enter the next record. Replace 1234 with the form's own module ID.

{
"Title": "Initialize Form And Stop Execution",
"ActionType": "InitActionForm",
"Description": "Start a new entry after saving",
"Condition": "\"[Saved]\" == \"true\"",
"Parameters": {
"ModuleId": "1234",
"Params": [
{
"name": "Mode",
"value": "New"
}
]
}
}

Revised 09/27/2026