I want to load JSON data from a cookie in the from so it could send via mail. But I cannot get it working. So I tried the demo from the documentation „loadCustomValues“. But this also didn‘t work. All I see in the email are the placeholders.
Here my FormIt call:
[[!FormIt?
&preHooks=Cookie2FormIt
&hooks=email
&emailTpl=fi_email_taxi
&emailTo=dsfgasdf@dsfgdsf.com
]]
Note that using the setValues() method here will make the corresponding placeholders available to your email chunk; the effect of manually setting values is similar to adding hidden fields to your form.
When you set a value with $hook->setValue() in a preHook, this only works on the first request, when the form it not submitted.
On form submission, the values you set here get ignored
So for a value to be available as a placeholder in the email hook, either use $hook->setValue() in a custom hook that runs before the email hook, or maybe you could use $modx->setPlaceholder('key','value') in the prehook.