Hmmm. So Formit accepts other values from the custom hook, but *not* redirect. Here's the snippet now (as simple as I can make it)
$datestamp = date('Y-m-d H:i:s');
$nextpage = $hook->getValue('number-required');
$recipient = $hook->getValue('email');
$hook->setValue('datestamp_submitted', $datestamp);
$hook->setValue('email_address', $recipient);
$hook->setValue('gotopage', $nextpage);
$modx->log(modX::LOG_LEVEL_ERROR, 'pageid is: '.print_r($nextpage,true));
return true;
Formit:
[[!FormIt?
&hooks=`altRedirect,email,redirect`
&validate=`number-required:required:minLength=`1``
&store=`1`
&emailTpl=`emailTpl`
&emailTo=`[[+email_address]]`
&emailSubject=`Test Form`
&redirectTo=`[[+gotopage]]`
&submitVar=`go`
]]
Email Tpl:
<p>Hello [[+firstname]]</p>
Page: [[+gotopage]]<br />
Email: [[+email_address]]<br />
Phone: [[+telephone]]<br />
Day: [[+datestamp_submitted]]
The email is duly sent to [[+email_address]] and in the email, [[+gotopage]] is replaced by an integer. But the form refuses to redirect to this integer because, in the log, it says, again, "..`[[+gotopage]]` is not a valid integer and may not be passed to makeUrl()"
Why not? Why isn't +gotopage an integer when it returns to Formit? I confess I have no earthly idea. Can someone point to the error in my code?