[TYPO3-dev] Using formhandler; How to replace database uid values from selectboxes with readable text for emails
Stano Paška
stano.paska at gmail.com
Fri Aug 20 21:09:56 CEST 2010
Hi Thomas.
In some of our project we do it by own interceptor:
# Typoscript
plugin.Tx_Formhandler.settings.additionalIncludePaths.1 =
typo3conf/ext/myext/Classes/Interceptor/
plugin.Tx_Formhandler.settings.predef.Form1 {
...
saveInterceptors.1.class = Tx_Formhandler_Interceptor_MyInterceptor
...
}
# and php code in
myext/Classes/Interceptor/Tx_Formhandler_Interceptor_MyInterceptor.php
class Tx_Formhandler_Interceptor_MyInterceptor extends
Tx_Formhandler_AbstractInterceptor {
function process() {
# explode $this->gp['usergroup']
# for each item convert uid to name and add result to tmp array
# implode tmp array with comma
# assign result back to $this->gp['usergroup']
return $this->gp;
}
}
Stano.
On Fri, Aug 20, 2010 at 5:55 PM, Thomas "Thasmo" Deinhamer
<thasmo at gmail.com> wrote:
> Hello folks!
>
> I'm populating a selectbox with usergroups from the database.
> Therefor I'm setting a custom marker using TS and add this
> marker to the HTML form template.
>
> The sourc then generated looks like this:
>
> <select name="formhandler[usergroup]">
> <option></option>
> <option value="1">Group 1</option>
> <option value="2">Group 2</option>
> ...
> </select>
>
> Note the "value" attribute. It holds the actual uid of the
> usergroup for each option someone could choose.
>
> The problem now is, that also this value gets displayed in
> the emails, which are sent to the user, but not the readable title.
>
> The text in the email looks like this:
>
> "You've chosen this usergroup: 1"
>
> Furthermore if the selectbox allows the user to choose
> multiple options, the text will look like this:
>
> "You've chosen this usergroup: 1,2"
>
> Instead something like this should be sent:
>
> "You've chosen this usergroup: Group 1, Group 2"
>
> Is there any built-in or any self-crafted solution available for this?
> I'm not sure how this could be handled correctly.
>
> Thanks a lot in advance!
>
> Thomas
> _______________________________________________
> TYPO3-dev mailing list
> TYPO3-dev at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-dev
>
More information about the TYPO3-dev
mailing list