Closed stefanschleich closed 4 years ago
It's not supported currently and it's also not that easy. People tend to think about the easiest cases like input fields that have one value. But there are many different form field types. From types that allow multiple values such as the checkbox wizard to upload form fields. Plus all the third party form fields that can basically do whatever they want to.
Maybe its possible to offer a solution, that is only usable with programming.
e.g. adding a template for the overview page, where all field values can be read and displayed. When the corresponding field id is kept, it should be possible to get infos from the configuration.
This will be a more developer friendly way, but will offer a solution.
Feel free to work on a solution if you need that.
Any hint, where to get the data from?
The MPFormsFormManager
handles everything and you can use this method to get all the data: https://github.com/terminal42/contao-mp_forms/blob/hotfix/3.0.6/MPFormsFormManager.php#L297
Personally, I'd develop a new form field "summary" or similar that can be placed in front of the last step and then render all the data in there. I guess you could - by default - render all widgets in disabled state with the respective value there so everybody gets kind of an okay-ish overview by default and then allow them to change the template to do whatever they want if they don't like the default view.
Sounds good. I will have a try.
Thanks, guys. I think I can get a temporary solution out of this. It'd be great if you find a way to make it work out of the box, Cliff 👍
Sounds good. I will have a try.
Hey, Cliff, did you do a try on that?
@felixpfeiffer No, sorry. Got no project so far.
Hello, I would like to use it. Is there any solution now?
The
MPFormsFormManager
handles everything and you can use this method to get all the data: https://github.com/terminal42/contao-mp_forms/blob/hotfix/3.0.6/MPFormsFormManager.php#L297
@Toflar Unfortunately the link does not work any more.
Just take the correct branch. The class is still the same.
Just take the correct branch. The class is still the same.
@Toflar Thank you for your respond. I just want to assure. I have to use this to output the data?
<?php echo $this->getDataOfAllSteps ?>
I would like to use the php function foreach to formate the resume.
Here the current link for all of us: https://github.com/terminal42/contao-mp_forms/blob/master/MPFormsFormManager.php#L305 (to see the storage of all data of all steps)
I don't know where you want to use that code. It looks more like template code but you first need to implement all the other logic. Maybe have a form field that outputs the code etc. So we're not talking about templating here, there is just absolutely nothing implemented at all at the moment.
I see. I put it into a template (for HTML). :-) Could you give me a kick/tip, please? I looked at the code of contao-countryselect for inspiration.
Not really no, I might as well just build it myself then. I'm not against including a solution and I have a few ideas how it might work best. I just haven't had any project that needed it so it remains an idea... :)
@jankout Have you developed a working solution?
Just to leave this for future readers: I'm happy to work on a solution as commissioned work. I think a nice solution should be doable within a day or two. Also see https://www.terminal42.ch/en/open-source.html.
That sounds amazing. Thank you!
We built a solution but it was very unflexibel. I would prefer a integrate solution.
Great News!
I built my workaround with the "loadFormField" hook. But this solution isn't flexible enough to make it public.
Just to be clear: I said I would be willing to work on a solution if it was commissioned work and I gave an estimate on how much time would be needed. Nobody employed me to do so at the moment.
OK ;-)
The next time I get a paid order for this feature, I will gladly forward it to you.
Habe Version dev-feature/placeholder-element für Testzwecke installiert. Scheint bereits lauffähig zu sein - danke!
Kann man ein Inserttag bereitstellen das alle ausgefüllten Elemente mit Label ausgibt? So müsste man die Zusammenfassung nicht immer ändern wenn sich das Formular selbst ändert.
Ein Inserttag ##formlabel_*## wäre auch hilfreich.
Freu mich auf eine Antwort. Danke!
I have been working on this and it's now ready to be tested. You may use the current develop
branch which is set to become the 4.0.0 release.
Note that I did change a few things (e.g. the templates to fix the order of the submit buttons) which means you might need to adjust your CSS. That's why it will be 4.0.
After installation you will have a new summary form field where you can enter arbitrary HTML and use simple tokens. There's a vast array of tokens, supporting the values, the labels as well as form uploads. I've even added a debug token to help you check what you can use. Make sure you read the whole README in the correct branch (https://github.com/terminal42/contao-mp_forms/tree/develop) to learn about everything that's new and has changed.
Unfortunately, Simple Tokens are a bit limited in their functionality when you want to do {if
statements. You cannot use AND or OR conditions, or check if something is in an array. That's why I'm also working on a Pull Request to enhance the support in Contao 4.10. You may follow https://github.com/contao/contao/pull/1509 if you're interested.
Happy testing :)
I've improved the debug output using the Symfony VarDumper component so it should be even easier to see which tokens you can use 😎
Also, I've tagged 4.0.0-rc1, so you don't necessarily have to require dev-develop
but can work with the RC version instead.
Erst einmal Danke für deine Arbeit! Ich habe Version dev-develop (11.03.2020, 09:14) installiert. Formular wird angezeigt, meine simpletokens für Radiobuttons, Inputs und Textarea werden wie gewünscht in der Zusammenfassung angezeigt. Mein letzter Pagebreak sendet an die gewünschte Mailadresse. Die E-Mail ist aber leider leer.
Auszug aus der mail-src unter https://community.contao.org/de/showthread.php?68645-terminal42-contao-mp_forms-eingebene-Werte-auf-letzter-Seite-vorm-Absenden-anzeigen
Das Senden der Daten hat mit mp_forms eigentlich nichts zu tun. Wie hast du denn den Mailversand konfiguriert?
einfach per Formulardaten versenden Per E-Mail versenden angehakt. Interessanterweise ist ja auch eine E-Mail angekommen, nur eben als weiße Seite, komplett ohne Text.
Kann ich nicht nachvollziehen. Funktioniert einwandfrei. Funktioniert es denn, wenn mp_forms nicht installiert ist?
Sorry, Fehler musste bei mir gelegen haben. Habe ein neues angelegt und das funktioniert problemlos.
I've just released 4.0.0. Happy form-ing!
Is it possible to show all data entered in the previous steps? This way the user could confirm it before finally submitting the form.
I already tried using
{{post::*}}
and$_SESSION['FORM_DATA']
but both seem to get filled only after the form is submitted.