Project

General

Profile

Actions

Feature #70384

closed

Make it possible to redirect (instead of forwarding) to referring action on validation error

Added by Viktor Livakivskyi over 8 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2015-10-05
Due date:
% Done:

0%

Estimated time:
PHP Version:
5.6
Tags:
Complexity:
Sprint Focus:

Description

When a validation error happens during form submission, the errorAction() forwards request to a previously called action and provides validation results to be shown and used on Fluid form.

However, when a form consists of multiple steps and each step is located on different page this leads to a problem: a page of next step is shown (all the surrounding CEs of next step are there), but the form from a previous step is displayed.

It would be helpful to have a possibility to redirect() to a previous step and preserve validation errors as well as user input.

I have tried to do it on my own, and found some solution for 2-step forms. However, for 3- and more steps this will fail.
https://forum.typo3.org/index.php/t/212078/


Related issues 3 (2 open1 closed)

Related to TYPO3 Core - Feature #77025: f:form: Disable referrer informationNew2016-07-11

Actions
Related to TYPO3 Core - Bug #97647: Forward to referring controller causes Property Mapping exceptionNew2022-05-17

Actions
Related to TYPO3 Core - Bug #89434: Action argument values will get lost on validation errorClosedAlexander Schnitzler2019-10-16

Actions
Actions #1

Updated by Christian Weiske almost 8 years ago

This would also help in scenarios where the input form is on a different page as the output plugin, e.g. a search form on the home page, and the result list on a separate page.

Currently extbase executes the search form action on the result list page. This leads to the problem that all the search form plugin settings are not available anymore, breaking the search form output.

Actions #2

Updated by Nicole Cordes almost 8 years ago

  • Status changed from New to Needs Feedback

Hi Viktor,

You can simply overwrite the errorAction() of your controller and do whatever you want if an error occurs. The thing is that e.g. post requests can't be redirected to another action as that would mean loosing your data.

Actions #3

Updated by Viktor Livakivskyi almost 8 years ago

Hi Nicole,

Yes, I've tried to perform overrides and partly succeeded with it. But the problem appears in case of object creation and form has 3 or more steps, represented by 3 actions in controller:

->step1()
->step2(MyObject $object)
->step3(MyObject $object)

In such case, if a validation error appears when going from step 2 to step 3, we'll need to redirect to step 2, which expects MyObject to be passed as an argument, and due to a fact, that object is not yet persisted, the UriBuilder fails to create a proper URL, since object has no uid yet.

I see, that it is a limitation of HTTP POST submitted forms - they can't be easily transformed into GET requests (special show-stopper would be submitted file).

The only question, that still remains: is it possible to have different pages for different steps of object creation? Or to be more specific: have different content blocks, which are surrounding plugin?

This surely can be achieved by using FlexForm of a plugin and insert CEs there, but with complex structures and translations it'll become a nightmare.

Actions #4

Updated by Alexander Opitz over 7 years ago

  • Status changed from Needs Feedback to New
Actions #5

Updated by Susanne Moog about 4 years ago

  • Status changed from New to Closed

There is no easy way to solve multi-step forms in a generic manner. I would suggest to use ViewObjects / DTOs for the single steps and validate those (if the steps are not necessarily validated in conjunction). Another API provided way would be to use the PHP-API of the TYPO3 FormFramework to build more complex multi-page/multi-step forms with validation. Please refer to the documentation for examples.

I'm going to close this issue now as I don't see a way to make this possible in general for all cases.

Actions #6

Updated by Simon Schaufelberger 2 months ago

  • Related to Bug #97647: Forward to referring controller causes Property Mapping exception added
Actions #7

Updated by Simon Schaufelberger 2 months ago

  • Related to Bug #89434: Action argument values will get lost on validation error added
Actions

Also available in: Atom PDF