Norman
Norman

Reputation: 805

TYPO3: Get the value of submitted forms inside custom Ext

My extension is built with the extension builder. The user has to enter his email and select a few checkboxes. After submitting the form, T3 sends an email according to the persons who were selected.

The checkboxes are dynamically managed in the backend and it's the only domain model within the extension.

I added a custom action to implement the switch and send the emails, but I can't get this one running. I have no idea, how to access the values which were submitted in the form. I tried $_POST['nameOfTheInputField'], as everyone would probably do, but nothing happens.

The form action is defined correctly and points straight to the custom action where I try to access the POST variable.

Does anyone know a solution or a tutorial where I can look this up? Google only throws results with tx_form or other T3 extensions which I'm obviously not interested in.

Upvotes: 0

Views: 2096

Answers (1)

biesior
biesior

Reputation: 55798

Extbase by default creates 2-level names for form fields like tx_yourext_plugin[field_name] so it will be rather $_POST['tx_yourext_plugin']['[field_name]'], anyway you should not access it by pure $_POST

Use some debugger and check the methods like:
$this->request->getArguments() (returns an array of arguments and their values)
or $this->request->getArgument('argumentName').

Also I assume that your send action gets some filled model's object (just guessing as you didn't mention that) like $message if that's true you can also access the values by
$message->getSomething();

Upvotes: 3

Related Questions