Project

General

Profile

Actions

Bug #16074

closed

params.textarea setting causes form element to disappear

Added by Bernd Weidner over 18 years ago. Updated over 18 years ago.

Status:
Closed
Priority:
Should have
Category:
Content Rendering
Target version:
-
Start date:
2006-04-20
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Setting for a FORM object:

params.textarea = style="width=100%;border:1px solid red"

will cause the textarea form element to disappear.

An analysis of the problem is given below as Additional Information.

Causeof problem:
In file class.tslib_content.php, function FORM
the $addParams string is merged into the format string of the
sprintf function call used to construct $fieldCode:

$fieldCode=sprintf('<textarea name="%s"'.$elementIdAttribute.' cols="%s" rows="%s"%s'.$addParams.'>%s</textarea>',
$confData['fieldname'], $cols, $rows, $wrap, t3lib_div::formatForTextarea($default));

The % in the width=100% specifier of the style attribute causes sprintf to return an empty string.

Workaround: use %% instead of % in params. settings

Note that this not really a good solution.
To somebody writing TYPOSCRIPT code it is rarely known whether the value of an attribute is inserted into an sprintf call by the method shown above.
Note also that this workaround only works, because the $fieldCode string is not itself processed by another printf or sprintf later.

Remedy: Instead of inserting the string itself into the format, specify it as another data parameter and include it in the output it by another %s.

This is a general problem that may arise with other TYPOSCRIPT property values in other functions as well, where the same style of coding is employed.

(issue imported from #M3309)


Related issues 1 (0 open1 closed)

Is duplicate of TYPO3 Core - Bug #14191: Incorrect handling of %-sign in FORM.paramsClosedRupert Germann2004-06-02

Actions
Actions #1

Updated by Ernesto Baschny over 18 years ago

Placing the $addParam outside the sprintf seems the obvious solution and replacing that with "%s" in the formatting-string. That's just ugly code. :) As this seems to happen in some other places in the FORM code, I'll consider to fix when I make some changes on that code again.

Actions #2

Updated by Ernesto Baschny over 18 years ago

Fixed by Rupi in CVS (see #132).

Actions

Also available in: Atom PDF