[TYPO3-english] Powermail - prefill field using a hook
Brian Bendtsen
bb at bellevuevej.dk
Thu Nov 13 20:32:48 CET 2008
Tapio Markula skrev:
> Brian Bendtsen
>> Now im getting somewhere, changed my function code to this:
>>
>> function PM_FieldWrapMarkerHook1($uid, $xml, $type, $title,
>> &$markerArray, $piVarsFromSession, $obj) {
>> if($markerArray['###POWERMAIL_FIELD_UID###'] == 5) {
>> //t3lib_div::devLog('test','wk_downloadcenter','',$type);
>> foreach($piVarsFromSession['uid5'] as $key=>$value) {
>> //$value .= $value.'</br>';
>> $newValueField .= $value;
>> }
>> $markerArray['###VALUE###'] .= 'value="'.$newValueField.'" ';
>> }
>> }
>>
>> But that leaves me with two value="" attributes, I thought the hook
>> would replace the existing one. Any ideas?
>
> of course that does because you have used '.=' and
> '$piVarsFromSession['uid5']' has several keys.
> '.=' adds new after existing string.
>
> for replacing one value you don't need foreach but just
> $markerArray['###VALUE###'] =
> 'value="'.$piVarsFromSession['uid5']['someKey'].'" ';
Hi, I of course didnt mean to use .= in the last line, but I actually
need the foreach, since the $piVarsFromSession['uid5'] is an array and I
need each value to be present in the value attribute.
Thanks for your help
/BB
More information about the TYPO3-english
mailing list