Neos.Form: Persist to a entity between each page

I’m building a form used in the signup process of a project. Between each page, I would like to persist the entered data to a entity, saved in a CRM. So, if a user doesn’t complete a signup, we at least got data so we can contact them.

Different from a Finisher, this is suppose to happen between each page and not just at the very end.

There is the onSubmit method described in the docs. This requires me to implement my own Page object and use that in my custom FormFactory class.

Is this the way to go?

And how what I do that? Add a Element to hold a Uuid from the CRM?

Does anyone here have had a similar usecase and did the same?

Hi @sorenmalling,

That can get a little tricky (consider what happens if the user clicks back and forth through the form pages).
You could send the intermediate steps via AJAX asynchronously but, yes, you can also do that via PHP.

That callback is only invoked on the form elements not on pages. But you can use the beforeRendering callback to send the current state before the form page is rendered.
I just gave it a quick try: Flow Form Framework: Persist form state on each page · GitHub

HTH
Bastian

1 Like

@sorenmalling did that help?

@bwaidelich I haven’t been back to test it yet. Another solution that came up, was simply to create a new Page element for each page or look at how Neos.Setup does it’s callback - it seems to be very custom but could be more of the way I wanted to take it.

Rest assured that I will get back with a solution somehow :smiley:

@bwaidelich

I think the “PersistedPage” concept of yours is the best approach so far and the one that have seemed to solve my issue.

I’ve created this github issue about the topic, perhaps it can be possible to get some “processing” possiblitity (similar to onSubmit on formElements) to use in between pages.

@sorenmalling Calling onSubmit on the $page somewhere here could work. But I’m not 100% sure what to send as 2nd argument (a reference to the “$elementValue”)…
Also, do you still need that mechanics or why not go for the “PersistedPage” approach?