[TYPO3-formidable] Re-Render form in actionlet to send content by mail

JéŽrô™me Schneider j.schneider at ameos.com
Tue Sep 27 10:16:17 CEST 2011


Dear Martin,

I think you'd be better off by using a dedicated template for the mail, 
rather than re-render the application for inclusion in an email.

In the php code behind your actionlet, you could do something like:
http://formidable.typo3.ug/pastebin/snippet/133.html

I hope this will help you.
--
Best regards,
Jerome


Le 22/09/11 15:39, Martin Terber a écrit :
> Hi there, we have a setup where we use Formidable with a typoscript
> setup (with initFromTs).
> Rendering new forms and getting form content from database into the
> template work fine on seperate pages.
>
> What I need to do now is to send the form content, once the data is
> submitted, by email. I created an actionlet for that:
>
> actionlets {
> 5 = actionlet:USEROBJ
> 5.userobj {
> extension = this
> method = sendRequestNotification
> }
>
> and in our extension class, I created a method that sends away the email
> notifications:
>
> public function sendRequestNotification() {
> [...]
> // Get form data from previously created request:
> $row = $this->form->aRawPost['formular'];
> [...]
> // 1. get mail template html code
> $message = $this->renderTemplate($row);
> $result = $this->ext->wrappedMailSender($toMail, $subject, $message,
> $fromEMail, $fromName = 'Sender's nam');
> [...]
> }
>
>
> public function renderTemplate($row) {
> [...]
> $this->form->initFromTs(
> $this,
> $this->conf['form.']['formname.'],
> $this->requestId
> );
> $result = $this->form->render();
> [...]
> }
>
> However, when trying to re-render the form, I get the error message:
>
> Formidable::Mayday
> Two (or more) renderlets are using the same name 'fieldname' on this
> form ('formular') - cannot continue
> Inclusions: EMPTY!
>
> This happens when I call the render() function.
> It is thrown because rendering a form with an existing renderlet
> structure is forbidden - unless a overwrite flag is set in function
> _makeRenderlets:
>  > function _makeRenderlets($aConf, $sXPath, $bChilds, &$oChildParent,
> *$bOverWrite = FALSE*)
>
> Does someone know:
> - How to avoid that Mayday Error? or
> - How to set the Overwrite flag ("bOverWrite") when calling the API?
>
>
> Greets:
> Martin Terber
> www.martinterber.com
>
>



More information about the TYPO3-project-formidable mailing list