FormItSaveForm through snippet

So FormIt has its own FormItSaveForm hook that you use inside the FormIt call to save a copy of a submitted form into the FormIt listing in the manager.

Is there a way to programmatically save an array of fields into this same listing? Why I ask is because we’re using a custom checkout procedure that goes to an external CC transaction, which when successful, then sends data back to an url on the website. Inside this URL are the fields I want to store, so obviously it can’t be done using just the FormIt call. Any ideas?


If I’m understanding you, I would think a custom snippet on the page at that URL would be the way to go. The data should be in the $_POST or $GET array.

The first step might be this line of code for the snippet:

$modx->log(modX::LOG_LEVEL_ERROR, "POST: " . print_r($_POST, true);
$modx->log(modX::LOG_LEVEL_ERROR, "GET: " . print_r($_GET, true);

Then look in the error log to see what you’re getting.

Thanks Bob, yeah I figured that much (it’s $_GET), but I don’t know enough about the intricacies of the rest of that snippet’s code. I got someone from the slack chat to help me with it.

@john, do you think you’d be able to post the solution you got from Slack here?

In general I am ok with that but the guy hasn’t gotten back to me with how much it will cost yet.

Oh, I assumed that you meant they were going to tell you the answer. I guess it depends if you get it solved or not. Good luck with it. :crossed_fingers:

The SaveForm hook fetches information from the FormIt Hook instance, not the $_GET or $_POST, so no, you’re not (easily) going to be able of calling that from a snippet. Unless you go the route of creating a fake formit and hook instance and passing that along, but I don’t know if that’s the best way to go.

The source code for the hook is here:

Most important thing it does is create a FormItForm record in the database.