Issue Bug Closed

#110493Bug: Form wizard always selects first template regardless of Blank/Predefined mode

Karina Balog 08/17/26, 11:58 updated 09/08/26, 10:02

Description

When creating a new form via the backend form wizard, the settings-step.js always selects the first configured template (templates0) in setPrototype(), regardless of whether the editor chose “Blank” or “Predefined” mode in the previous step.

Steps to reproduce:

1. Open Web > Forms
2. Click “Create new form“
3. Select “Blank” mode
4. In step 2 (settings), the prototype dropdown changes or a different
prototype is selected
5. The template dropdown is set to the first template in the list, even
if it is not the blank form template

Expected behaviour:

- If mode is “Blank”, the template should be the blank form (BlankForm.yaml
or equivalent).
- If mode is “Predefined”, the template should be the first non-blank template.

Actual behaviour:

setPrototype() in Resources/Public/JavaScript/backend/form-wizard/steps/settings-step.js
always picks templates0:

setPrototype(e){const a=this.context.formManager.getTemplatesForPrototype(e);this.setValue({prototype:e,template:a0?.value??”“})}

The MODE import from mode-step.js is available but unused. There is no logic to synchronise the selected template with the wizard mode chosen in step 1.

Impact:
Editors who select “Blank” may end up with a predefined form if the blank template is not the first in the YAML array. The outcome depends on the array order of yamlConfigurations, making the wizard behaviour inconsistent.

Suggested fix:
Add a getTemplateForMode(prototype, mode) method that returns the blank template when mode is Blank, and the first non-blank template otherwise. Call this from setPrototype() and from render() to re-synchronise when the mode changes between steps.

Reviews 2