Project

General

Profile

Bug #102055

Updated by Mathias Brodala 7 months ago

Given a form with conditional pages variants are not respected when the navigation is built. Example: 

 <pre><code class="yaml"> 
 type: Form 
 prototypeName: standard 
 identifier: multi-step-form 
 label: Muli step form 
 renderables: 
   - 
     type: Page 
     identifier: page-1 
     label: First step 
     renderables: 
       - 
         type: Checkbox 
         identifier: checkbox-1 
         label: Check this and the 2nd step will be skipped 
   - 
     type: Page 
     identifier: page-2 
     label: Second step 
     renderingOptions: 
       enabled: false 
     variants: 
       - 
         identifier: variant-2 
         condition: 'traverse(formValues, "checkbox-1") == 0' 
         renderingOptions: 
           enabled: true 
   - 
     type: Page 
     identifier: page-3 
     label: Third step 
     renderingOptions: 
       enabled: false 
     variants: 
       - 
         identifier: variant-2 
         condition: 'traverse(formValues, "checkbox-1") == 1' 
         renderingOptions: 
           enabled: true 
 </code></pre> 

 Enabling the checkbox on the 1st page and going to the next page will show the 3rd page and a "Submit" button. 

 Not enabling the checkbox on the 1st page and going to the next page will show the 2nd page and a "Next Page" button. However, there is no next page here. In this case the button should also say "Submit". 

 The example above generally disables all subsequent pages and conditionally enables them which is a logical approach IMO. Especially because it allows you to have conditions which match their page 1:1. The reverse logic as "suggested suggested by the docs":https://docs.typo3.org/c/typo3/cms-form/main/en-us/I/Concepts/Variants/Index.html?highlight=steps#hide-steps docs also doesn't work however: 

 <pre><code class="yaml"> 
 type: Form 
 prototypeName: standard 
 identifier: multi-step-form 
 label: Muli step form 
 renderables: 
   - 
     type: Page 
     identifier: page-1 
     label: First step 
     renderables: 
       - 
         type: Checkbox 
         identifier: checkbox-1 
         label: Check this and the 2nd step will be skipped 
   - 
     type: Page 
     identifier: page-2 
     label: Second step 
     variants: 
       - 
         identifier: variant-2 
         condition: 'traverse(formValues, "checkbox-1") == 1' 
         renderingOptions: 
           enabled: false 
   - 
     type: Page 
     identifier: page-3 
     label: Third step 
     variants: 
       - 
         identifier: variant-2 
         condition: 'traverse(formValues, "checkbox-1") == 0' 
         renderingOptions: 
           enabled: false 
 </code></pre>

Back