I use Eclipse + pdt to do my php stuff. There I could immidiately see, that there is a default value parameter for the TextField.
Only thing is, it doesn't work (as I hoped it would).
I didn't understand why it wouldn't work, so I came looking in the forum. And I found this http://www.silverstripe.org/archive/show/85210
Well, and this was exactly the way I was trying to get a prefilled input field. Made me crazy. Till I just copy-pasted the code. And it worked. But why. Again it made me crazy, untill I just tried to use other names/parameters in my fields. And it worked, again It made me crazy, didn't know what was going on.
Now I know. If I do this
public static $db = array( 'Foo' => 'Text');
$fields->addFieldToTab('Root.Content.Main', new TextField("Foo","Bar","Test"),'Content');
the Foo Input stays empty
but with this
$fields->addFieldToTab('Root.Content.Main', new TextField("notFoo","Bar","Test"),'Content');
it works and "Test" is written inside of the "notFoo" Input
So if the TextField "name" parameter is a key in the $db array, it doesn't work.
What to do?
Is there a workaround ? I mean, I need the value written into the db, so the name value must exist in the $db array, doesn't it?
Or is there another input type to use ?
Thanks in advance and greetings from Germany