Alright, I've been trying something on my own. My idea is to have two submit buttons, and with a custom hook check which one is clicked. Based on that I forward to the previous form page or the next.
Now I want the filled in values to display with formItRetriever, be it going back or forth. It's not working though... I'm going crazy over this ;-)
FORM 1 (ID 22) (this one is just forwarding)
[[!FormIt? &hooks=`redirect` &store=`1` &redirectTo=`30`]]
[[!FormItRetriever]]
<form class="form" action="[[~[[*id]]]]" method="post">
<input type="hidden" name="naam" value="[[!+fi.naam]]" />
<label for="content">
Reactie:
<span class="error">[[+fi.error.content]]</span>
</label>
<textarea id="reactie" cols="55" rows="7" name="reactie:required:stripTags">[[!+fi.reactie]]</textarea>
<div class="form-buttons">
<input type="submit" value="Verder!" />
</div>
</form>
FORM 2 (back and forth)
[[!FormIt? &hooks=`backOrForward` &store=`1`]]
[[!FormItRetriever]]
<form class="form" action="[[~[[*id]]]]" method="post"><input type="hidden" name="nospam:blank" /> <input type="hidden" name="resource_id" value="[[!+fi.id]]" />
<input type="hidden" name="genomineerde_id" value="[[!+fi.genomineerde_id]]" />
<input type="hidden" name="reactie_id" value="[[!+fi.reactie_id]]" />
<label for="naam"> Naam: <span class="error">[[+fi.error.naam]]</span> </label>
<input id="naam" type="text" name="naam:required" value="[[!+fi.naam]]" />
<div class="form-buttons">
<input type="submit" name="previous" value="Terug!" />
<input type="submit" name="next" value="Verder!" />
</div>
</form>
And the snippet I made (backOrForward):
$modx->log(modX::LOG_LEVEL_ERROR,'START BACK OR F0RWARD');
if (isset($_POST['next'])) {
$modx->log(modX::LOG_LEVEL_ERROR,'next clicked');
$url = $modx->makeUrl(31);
$modx->sendRedirect($url);
} else if (isset($_POST['previous'])) {
$modx->log(modX::LOG_LEVEL_ERROR,'previous clicked');
$url = $modx->makeUrl(22);
$modx->sendRedirect($url);
} else {
$modx->log(modX::LOG_LEVEL_ERROR,'nothing clicked');
$url = $modx->makeUrl(100);
$modx->sendRedirect($url);
}
The back and forth forwarding works, but the values are not stored.