[TYPO3] presetting a TV field
Peter Foerger
p.foerger at vke-design.de
Wed Mar 29 14:00:20 CEST 2006
Hi Peter,
Peter Klein schrieb:
> Hi List. Does anyone knows if its possible to preset values in a flexform?
>
> I have a form, where I want a field to be filled with a specific value as
> default, but still letting the user change it..
>
> As the TV manual is pretty sparse, I haven't been able to find anything
> about setting default values.. :/
>
e.g.
<config>
<type>input</type>
<size>35</size>
<default>17, 16.5, 16.5, 15.5</default>
</config>
Depending on the TYPO3 version you might have to patch
t3lib/class.t3lib_tceforms.php to display the default values:
Index: t3lib/class.t3lib_tceforms.php
===================================================================
RCS file: /cvsroot/typo3/TYPO3core/t3lib/class.t3lib_tceforms.php,v
retrieving revision 1.51
diff -u -r1.51 class.t3lib_tceforms.php
--- t3lib/class.t3lib_tceforms.php 27 Apr 2005 09:57:50 -0000 1.51
+++ t3lib/class.t3lib_tceforms.php 19 May 2005 17:15:11 -0000
@@ -2158,7 +2158,12 @@
$fakePA['itemFormElName']=$PA['itemFormElName'].$formPrefix.'['.$key.']['.$vDEFkey.']';
$fakePA['itemFormElName_file']=$PA['itemFormElName_file'].$formPrefix.'['.$key.']['.$vDEFkey.']';
- $fakePA['itemFormElValue']=$editData[$key][$vDEFkey];
+ if(isset($editData[$key][$vDEFkey])) {
+ $fakePA['itemFormElValue']=$editData[$key][$vDEFkey];
+ }
+ else {
+
$fakePA['itemFormElValue']=$fakePA['fieldConf']['config']['default'];
+ }
$rowCells['formEl']=
$this->getSingleField_SW($table,$field,$row,$fakePA);
$rowCells['title']=
htmlspecialchars($fakePA['fieldConf']['label']);
Best regards
Peter
More information about the TYPO3-english
mailing list