Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wertänderung im load_callback wird nicht gespeichert #2557

Closed
Samson1964 opened this issue Dec 10, 2020 · 3 comments
Closed

Wertänderung im load_callback wird nicht gespeichert #2557

Samson1964 opened this issue Dec 10, 2020 · 3 comments

Comments

@Samson1964
Copy link

Contao 4.8/4.9

Das nachfolgende Problem ist ausführlich im Contao-Forum dokumentiert:
https://community.contao.org/de/showthread.php?79668-Verwendung-von-load_callback-und-save_callback

In einem load_callback will ich ein Feld automatisch mit einem Wert befüllen. Der Wert wird im BE-Formular angezeigt, anschließend aber nicht gespeichert. Dieses Verhalten läßt sich in meinem Bundle https://github.com/Samson1964/contao-kaderlisten-bundle/releases/tag/1.2.1 nachvollziehen.
Nur wenn ich das Feld per Hand befülle (also nicht im Callback), wird der Wert gespeichert.

Ich habe testweise vom load_callback zurückgeben lassen:

return $varValue.'PP';

Im BE-Formular erscheint der Wert mit angefügtem "PP". Beim Speichern fehlt "PP" wieder.

Beispiel mit $varValue = 'Test':
Füge ich in meinem DCA zusätzlich noch einen save_callback ein wird bei nur (ohne Manipulation)

return $varValue;

nichts gespeichert (statt 'Test'), wenn das Feld vorher von meinem load_callback befüllt wurde.

Mache ich im save_callback stattdessen ein

return $varValue.'PP';

wird sowohl $varValue als auch 'PP' gespeichert, also 'TestPP'.

@aschempp
Copy link
Member

You can try to set alwaysSave = true in your eval configuration.

@Samson1964
Copy link
Author

Danke, das war es!

@Toflar Toflar closed this as completed Dec 15, 2020
@fritzmg
Copy link
Contributor

fritzmg commented Dec 22, 2020

You can try to set alwaysSave = true in your eval configuration.

Seems weird though that you have to do that? Why would the DC_Table not save the submitted value in this case?

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants