Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2024-03-30 16:26:50

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,734
Website

Display details from com_connect form in thanks_form? [resolved]

This is another one of those “I’m sure I got this working before” things. I’d like to display selected parts of the submitted form in a com_connect thanks_form.

I can see the submitted details in the browser devtools:

but getting at them proved convoluted. I though I could retrieve them as $_POST variables using <txp:page_url type="empfaenger" /> or perhaps <txp:php>echo ps('empfaenger');</txp:php>, but no luck.

After some experimentation, I have this:

<txp:php>
global $variable;
parse_str(file_get_contents("php://input"), $data);
$data = (object)$data; // Cast it to an object
$variable['recipient'] = $data->empfaenger;
</txp:php>

which gives me a txp variable to use elsewhere, e.g. <txp:variable name="recipient" />.

My question: Is there an easier way to do this?


TXP Builders – finely-crafted code, design and txp

Offline

#2 2024-03-30 17:19:12

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,456
Website GitHub

Re: Display details from com_connect form in thanks_form? [resolved]

You should be able to access them via the built in tags like <txp:com_connect_value>. But its success may depend on the type of field you’re accessing. There’s a bug with the file input that phiw13 uncovered for example. And getting at multiple checkbox values may or may not be easy.

If you hit any snags, I’ll see if we can make it simpler.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2024-03-30 18:09:49

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,734
Website

Re: Display details from com_connect form in thanks_form? [resolved]

Perfect! Classic case of overthinking things. I thought that tag was for the custom email body but it works here just fine. My case is a to_form select box. Thank you!


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB