#110692Problem on https://docs.typo3.org/c/typo3/cms-scheduler/main/en-us/Administration/StopTask/Index.html
Description
Hello,
Thank you very much for the new API in Scheduler. I’m excited about the new approach. I now want to migrate my handful of Scheduler tasks with many parameters. Unfortunately, I’ve noticed two undesirable behaviors:
1. debug(....) no longer really works. Only if I put an exit; right after it do I see the debug output.
2. The validation is only semi-practical: if the method
public function validateTaskParameters(array $parameters): bool
returns false, the form forgets the incorrect input. In other words, if the user entered a longer JSON, for example, and validation says, “You forgot a key,” everything is gone. That’s very annoying…
Is there a solution for these two points?
Reviews 2
Related issues 1
History 1416
-
Benni Mack commented and changed status
NewNeeds Feedback <span data-processor="relativetime" data-value="2026-09-14T16:11:45+00:00" > 09/14/26, 16:11 </span> -
C. Gogolin commented <span data-processor="relativetime" data-value="2026-09-19T07:45:14+00:00" > 09/19/26, 07:45 </span>
If I understand you correctly, the FormEngine does the following:
- > Load persistent data - > Put it into the form and display it :: When the user presses save - > Transient data comes from the form - > Validation is started ---- > Fields can check their own content (check) ---- > Cross-field validation is started - > The validation results are remembered for the next redirect, but the transient form data is discarded -- > If validation says: OK -> save -- > If validation says: failed -> do not save - > and always you start again from scratch...Did I understand that correctly?
If one were to design the save process as a transient process, then debug() and validation would supposedly work as expected… (I’d say ;) )
New version:
- > Load persistent data - > Put it into the form and display it :: When the user presses save - > Transient data comes from the form - > Validation is started ---- > Fields can check their own content (check) ---- > Cross-field validation is started - > The validation results are remembered -- > If validation says: OK -> save -- > If validation says: failed -> the form gets the data from the transient data of the last form callWhat do you think?
I’d also be willing to take a crack at it if you give me a tip on where I should start…
-
Garvin Hicking commented <span data-processor="relativetime" data-value="2026-09-21T08:50:35+00:00" > 09/21/26, 08:50 </span>
The FormEngine is the “frontend part” of displaying the form. It comes with client-side validation (JavaScript) so the user will actually not even submit the values, but validation errors are displayed before that. So with that way, you cannot end up with a submitted form that is missing the server-side unvalidated data.
About Bennis “Otherwise” idea, the best way to start is to go from the EditDocumentController and trace the Input-Route -> FormEngine -> Client Validation -> Submit -> EditRoute -> Server Validation -> DataHandler route to see how this is built, then at the Server Validation handoff implement the “temporary persistence” logic, which you could then read out at the Input-Route -> FormEngine handoff.
HTH!
-
C. Gogolin commented <span data-processor="relativetime" data-value="2026-09-26T07:09:35+00:00" > 09/26/26, 07:09 </span>
Before I really dive into this, I have one more question to make sure I understand the architecture correctly:
In TYPO3, the TCA definitions seem to act as a single source of truth. Client-side validations are derived from these definitions and executed in the browser.
Are the same validations also executed again on the server side?
On the server side, much more sophisticated validation is possible, for example checks that depend on other records or external context.
What happens if a server-side validation rejects a value that the (untrusted) client-side validation did not detect?
Would that result in the same behaviour I am currently seeing with the Scheduler, where the validation fails only during the server-side processing and the submitted values are subsequently lost?
I am asking because it seems that this scenario could occur independently of the Scheduler whenever a validation rule exists only on the server side.
-
Gerrit Code Review pushed patch set 1 for main to change 96122 status
Needs FeedbackUnder Review <span data-processor="relativetime" data-value="2026-09-28T10:02:09+00:00" > 09/28/26, 10:02 </span> -
Benni Mack commented <span data-processor="relativetime" data-value="2026-09-28T10:05:55+00:00" > 09/28/26, 10:05 </span>
C. Gogolin wrote in #note-4:
> Before I really dive into this, I have one more question to make sure I understand the architecture correctly:
I don’t know anyway, so I pushed one idea… i don’t know for sure which might work.
-
C. Gogolin commented <span data-processor="relativetime" data-value="2026-10-03T15:00:55+00:00" > 10/03/26, 15:00 </span>
Thank you for your first draft…
If I understand your code correctly, you’re storing form data that didn’t pass server validation in the session.
Maybe I’m too inexperienced, but I don’t understand the reasoning behind this approach. I would have expected that if a form fails validation and is immediately re-requested, the session would be cleared anyway—so what’s the benefit of storing the invalid data?
Additionally, why use a redirect instead of a forward in the error case? In my experience with form handling, a forward (which keeps the request server-side) would make more sense than sending the user’s browser to a new URL via redirect.
I may be approaching this from the wrong angle, but I’d really like to understand the design decision here, as it differs from how I’ve typically handled forms.
-
C. Gogolin commented <span data-processor="relativetime" data-value="2026-10-14T13:09:10+00:00" > 10/14/26, 13:09 </span>
No worries, I’m still working on it…
I’m guessing you haven’t checked your code against the current Scheduler validation API.
Because
$erroneousRecords = $dataHandler->printLogErrorMessages();is always empty…
you simply send a flash message… but that doesn’t end up in $erroneousRecords.
I stumbled across this when I was pursuing a different solution: without caching in the session. <— that doesn’t work either…
IMHO: It should be sufficient to have the following in EditDocumentController#mainAction():
if ($requestAction->isPostRequest) { if ( $processResult !== null && !$processResult->successful ) { $request = $request->withAttribute( 'submittedData', $processResult->submittedData ); } else { // In case save&view is requested, we have to add this information to the redirect // URL, since the ImmediateAction will be added to the module body afterward. if ($requestAction->savedokview()) { $queryParamsForGeneratingCurrentUrl['showPreview'] = true; $queryParamsForGeneratingCurrentUrl['popViewId'] = $this->popViewId; } } $url = $this->uriBuilder->buildUriFromRoute('record\_edit', $queryParamsForGeneratingCurrentUrl); return new RedirectResponse($url, 302); }(If #processData() returns the following:
return new ProcessDataResult( successful: empty($erroneousRecords), submittedData: $dataMap, erroneousRecords: $erroneousRecords );)
I don’t understand so much: How do I get anything into $erroneousRecords with the Scheduler?
Even if I bypass the redirect, it still gets saved – apparently the validation flash messages are being ignored?Do you understand this?
-
Benni Mack commented <span data-processor="relativetime" data-value="2026-10-15T17:15:45+00:00" > 10/15/26, 17:15 </span>
C. Gogolin wrote in #note-8:
> No worries, I’m still working on it…
>
> I’m guessing you haven’t checked your code against the current Scheduler validation API.
sorry, no.> According to:
> https://docs.typo3.org/c/typo3/cms-scheduler/main/en-us/DevelopersGuide/CreatingTasks/Index.html#implementation-of-a-custom-scheduler-taskThis documentation is obviously wrong.
-
C. Gogolin commented <span data-processor="relativetime" data-value="2026-10-15T20:35:03+00:00" > 10/15/26, 20:35 </span>
>
> > According to:
> > https://docs.typo3.org/c/typo3/cms-scheduler/main/en-us/DevelopersGuide/CreatingTasks/Index.html#implementation-of-a-custom-scheduler-task
>
> This documentation is obviously wrong.This is doof gelaufen ;) Sorry…
Is the documentation better?
-
C. Gogolin commented <span data-processor="relativetime" data-value="2026-10-17T15:36:53+00:00" > 10/17/26, 15:36 </span>
Thank you for your help… The following lines are not meant to diminish your efforts.
Many thanks for your approach, Benni. You invested time and energy in this – but to be honest, I don’t think this solution is good. At my workplace, such a solution wouldn’t be accepted either.
I have to admit, I’m frustrated. The documentation for the Scheduler doesn’t work. The AbstractValidator doesn’t work for me either, because it doesn’t function with the Scheduler data model.
IMHO-Begin:*
> If I understand correctly, the TCA information is used for JavaScript validation, but not for server-side validation. Otherwise, this behavior would have been noticed long ago. Instead, a cumbersome model validation with annotations was built, which doubles the maintenance effort. I don’t understand why this information isn’t simply stored in the TCA definition in the first place.
>
> Even if it takes resources, all data should be validated on the server side once more – and just as thoroughly, or even better. The TCA could thus handle all attribute validations generically and keep them up-to-date.
>
> Individual validations are still missing: A generic check to see whether a JSON field contains valid JSON is not always sufficient from a business perspective. If you could store validation classes for attributes in the TCA definition – classes that also have access to the entire object – you could quickly solve many things without building a model with annotations. The frontend could benefit from this as well.
>
> And then there’s the REDIRECT. It might make sense in the case of a valid object – but as long as we’re still struggling with “invalid” input, I consider this redirect inappropriate, and it unfortunately forces you (Benni) to implement such a session-caching solution. I can’t estimate what effects might occur when I have the backend open in many tabs.
*IMHO-EndFeel free to close the ticket…
____
Fürs deutsch Publikum, damit der Ton bei der Übersetzung nicht “beschädigt” wird.
____
Danke für eure Hilfe… Die folgenden Zeilen sollen echt euer Engagement schmälern.
Vielen herzlichen Dank für Deinen Lösungsansatz, Benni. Du hast da Zeit und Energie reingesteckt – aber ganz ehrlich diese Lösung finde ich nicht gut. Auf meiner Arbeit würde so eine Lösung auch nicht akzeptiert werden.
Ich muss leider eingestehen, ich bin frustriert. Die Doku beim Scheduler funktioniert nicht. Der AbtractValidator tuts bei mir auch nicht, weil er für das Scheduler-Datenmodell nicht funktioniert.
IMHO-Begin:
> Wenn ich das richtig verstanden habe, werden die TCA-Infos zwar für JavaScript-Prüfungen genutzt, aber nicht für eine serverseitige Prüfung. Sonst wäre das Verhalten schon längst aufgefallen. Statt dessen wurde eine umständliche Model-Validierung mit Annotationen aufgebaut, was die Pflege verdoppelt. Warum diese Infos nicht gleich in der TCA-Definition hinterlegt werden, erschließt sich mir nicht.
>
> Auch wenn es Resourcen frist, sollten alle Daten auf der Server-Seite noch mal genauso oder noch besser geprüft werden. Das TCA-könnte damit alle Attribute-Prüfungen gleich generisch und hochaktuell abfrühstücken.
>
> Die individuellen Prüfungen fehlen dann noch: Eine generische Prüfung, ob ein JSON-Feld ein JSON enthält, ist fachlich nicht immer ausreichend. Wenn man bei der TCA-Definition die Validierungsklassen für Atrribute hinerlegen könnte, die auch gleich Zugriff auf das ganze Objekt hätten, könnte man schnell vieles erledigen ohne ein Model mit Annotationen zu bauen. Davon könnte auch das FE profitieren.
>
> Und dann ist da noch das REDIRECT. Das mag im Fall eines validen Objekt sinnvoll sein – aber solange man sich noch mit „defekten” Eingaben herumärgert, halte ich das Redirect für unangebracht und das zwingt Dich (Benni) leider zu so einer Session-Zwischenspeicher-Lösung. Welche Effekte dabei entstehen, wenn ich das BE in vielen Tabs offen habe, kann ich nicht abschätzen.
*IMHO-End*Meinetwegen könnt ihr auch gerne das Ticket schließen…
-
Gerrit Code Review pushed patch set 1 for main to change 96804 <span data-processor="relativetime" data-value="2026-10-17T20:37:20+00:00" > 10/17/26, 20:37 </span>
-
Garvin Hicking commented <span data-processor="relativetime" data-value="2026-10-17T20:50:19+00:00" > 10/17/26, 20:50 </span>
Hey,
please have a look at my patch. I did find out that in fact the FlashMessage handling has an issue and think it would deserve a bugfix.
Additionally I extended EXT:styleguide and the docs for a validation example, sharpening the docs, and explaining that server-side and client-side synchronicity is currently the “best bet” to prevent a loss of user input. Anyhow, I do think it’s worth following a way of making failstates utilize the previous user input so it can be corrected. Clemens, your small patch to forward the data looks quite interesting. Can you please push a patch to gerrit so we can see how it works in CI? This is a distinct issue, so we should create its own forge issue for it, something like “Keep submitted user data in FormEngine re-display after errors”.
Also, let’s focus on the task and hand and a way forward, not frustration. Frustration leads to anger, anger leads to hate, hate leads to suffering. Benni is awesome and he’s really doing so much for everyone, sometimes it’s hard to satisfy everyone and understand implied or explicit “undertones” (and that applies to all of us, not just Benni).
-
C. Gogolin commented <span data-processor="relativetime" data-value="2026-10-18T15:11:02+00:00" > 10/18/26, 15:11 </span>
bfr &ghi : ThanksI’ve been grumbling about this, and meanwhile I found the solution I was looking for:
Sorry…
The wording there: “Some of these evaluation keywords will trigger a JavaScript pre-evaluation in the form. Other evaluations will be performed in the backend. The evaluation functions will be executed in the list-order.” makes me a bit puzzled: Which of these are server-side and which are only in the browser?
@ghi, I’ve opened a ticket as you suggested.
https://forge.typo3.org/issues/111131Since I’m at odds with Gerrit, it will take a while before I figure out how to submit my idea as a patch to you (and yes – I’ve completely forgotten by now how to do it. I never really memorized all the different git commands.)
PS: Funny or strange: whenever I’m here, I only deal with you two. ;)
-
Garvin Hicking commented <span data-processor="relativetime" data-value="2026-10-18T17:47:33+00:00" > 10/18/26, 17:47 </span>
Could you have a look at the gerrit patch of mine? It uses eval and proposes more examples.
What is evaluated server and clientside depends on your eval class.You can just sign into gerrrit and vote -1 or +1 oth the patch itself (“code review”) and if it works for you (“verified”). The TYPO3 Contribution Guide explains it in depth.
Also there’s “typo3-tryout”, availavle as a ddev addon, allows you to easily interface with gerrit. Basically “one click”. You can submit your patch easily. Check it out on github.
Benni, Georg and me put intensive effort on our issue tracker, so the chances are near 100% you will text with one of us. You could sign up for ELTS and then ask the TYPO3 Gmbh though if you want to escalate to our “managers” ;-)
-
Garvin Hicking changed Related to #111131 <span data-processor="relativetime" data-value="2026-10-18T17:48:18+00:00" > 10/18/26, 17:48 </span>
Hey,
1. debug() – the reason is that validation happens in DataHandler at this point, because we now separate the form (FormEngine-based) from the persistence layer, also in terms of HTTP requests when persisting. So a debug() call made from inside validateTaskParameters() (invoked during DataHandler::process_datamap(), i.e. inside processData()) gets buffered — and then the controller redirects. “exit;” works – right after debug() terminates the script before the redirect is built, so PHP flushes the still-open buffer as a normal 200 response instead.
2. validation:
There is a solution in general – you can now create your own DB field (via TCA) with your own custom renderType to create validation like in any FormEngine validation logic. So I’d rather recommend that approach to you. Otherwise, we should finally implement a FormEngine persisting layer that keeps the failed information in the “uc” / sessionData (we could built this only for FormEngine) and then bring it back in FormEngine.
What do you think?