[TYPO3-dev] Error with checkbox
Daniel Calderini
daniel.calderini at wng.ch
Tue Dec 16 09:44:35 CET 2008
Hi list,
I have a problem with TCEForms in an extension.
I have the following field defined in the TCA of my ext.:
"type" => array (
"exclude" => 1,
"label" => "Label",
"config" => array (
"type" => "check",
"cols" => 4,
"items" => array (
array("Value 0", ""),
array("Value 1", ""),
array("Value 2", ""),
),
)
),
This works well, but I want the items list to be generated dynamically.
So I changed the TCA definition to this:
"type" => array (
"exclude" => 1,
"label" => "Label",
"config" => array (
"type" => "check",
"cols" => 4,
"items" => array(),
"itemsProcFunc" => 'tx_myext_lib->tcaFillType',
)
),
And here is my function:
public function tcaFillType(&$params, &$pObj) {
$data = array(
0 => 'Value 0',
1 => 'Value 1',
2 => 'Value 2',
);
foreach ($data as $key => $value) {
$params['items'][$key] = array($value, '');
}
}
The field is rendered, but changing values doesn't work:
- if I check "Value 0" or "Value 1", it works;
- if I check "Value 2" and save, "Value 1" is displayed as checked;
- if I check more than 1 value it is allways only "Value 1" that is
checked after saving!
Is it a bug or did I do something wrong in my function/TCA definition?
I wrote a similar function to fill the values of a select box and it
works well. Is there something different with checkboxes?
Thanks,
Daniel Calderini
More information about the TYPO3-dev
mailing list