17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1542 Views |
-
Label Error with $tablefield

24 June 2008 at 10:04pm
Hello Everyone...
I got the following Code from a tut in a german magazine, but rechecked it with the tut on this site // by an admin in the irc... Perhaps any Forum User can find the mistake i did...
Heres the Code for my HasManyComplexTableField:
class Referenz extends Page {
static $has_many = array(
'MyReferences' => 'Referenzen'
);function getCMSFields() {
$fields = parent::getCMSFields();
$tablefield = new HasManyComplexTableField(
$this,
'MyReferences',
'Referenzen',
array(
'Ersteller'=>'Ersteller_label',
'Kollektorart'=>'Kollektorart_label',
'Gebaeudeart' => 'Gebaeudeart_label',
'Dachtyp' => 'Dachtyp_label',
'Anlagengroesse' => 'Anlagengroesse_label',
),
'getCMSFields_forPopup'
);
$tablefield->setAddTitle( 'a Reference' );$fields -> addFieldToTab("Root.Content.Referenzen", $tablefield);
return $fields;}
}What it looks like is this:
Perhaps anyone can tell me, why there is just the first COlum labeled ["Ersteller"] and the others not... Okay, bad engloish for bad guys like me ^^
Would be happy if someone can help me out
Greetings,
BennY from .De -
Re: Label Error with $tablefield

30 June 2008 at 10:19pm
Is it allowed to upper topics unanswered ???
-
Re: Label Error with $tablefield

1 July 2008 at 3:02am
Can you show us the Referenzen object?
I almost wonder if you accidentally got some HTML in your data that is breaking the table. Seems very odd.
-
Re: Label Error with $tablefield

7 July 2008 at 10:36pm Last edited: 7 July 2008 10:37pm
Hopefully you mean the REFERENCEN.php ?
Here it is, the Names are german stuff, don't meantion it...
class Referenzen extends DataObject {
static $db = array(
'Ersteller' => 'Text',
'Kollektorart' => 'Text',
'Gebaeudeart' => 'Text',
'Dachtyp' => 'Text',
'Anlagengroesse' => 'Text',
'Standort' => 'Text',
'Stadt' => 'Text',
'Ertrag' => 'Text',
);static $has_one = array(
'Image' => 'Image',
'MyMyReferences' => 'Referenz'
);function getCMSFields_forPopup() {
$fields = new FieldSet();
$fields -> push( new TextField('Ersteller'));
$fields -> push( new DropdownField('Kollektorart','Kollektorart',singleton('Dropdown1')->dbObject('Kollektorart')->enumValues()));
$fields -> push( new DropdownField('Gebaeudeart','Gebaeudeart',singleton('Dropdown2')->dbObject('Gebaeudeart')->enumValues()));
$fields -> push( new DropdownField('Dachtyp','Dachtyp',singleton('Dropdown3')->dbObject('Dachtyp')->enumValues()));
$fields -> push( new DropdownField('Anlagengroesse','Anlagengroesse',singleton('Dropdown4')->dbObject('Anlagengroesse')->enumValues()));
$fields -> push( new DropdownField('Standort','Standort',singleton('Dropdown5')->dbObject('Standort')->enumValues()));
$fields -> push( new TextField('Stadt'));
$fields -> push( new TextField('Ertrag'));
$fields -> push( new ImageField('Image'));
return $fields;}
}
class Dropdown1 extends DataObject {
static $db = array(
'Kollektorart' => "Enum('Standart-Kollektor,Schrägschnitt-Kollektor,Aufgeständerter Kollektor,Solardach Plus (mit PV),Schwimmbadheizung','Standart-Kollektor')"
);
}class Dropdown2 extends DataObject {
static $db = array(
'Gebaeudeart' => "Enum('Einfamilienhaus,Mehrfamilienhaus,öffentliche Gebäude,Gewerbliche Gebäude,Landwirtschaftliche Anwesen,Denkmalgeschützte Gebäude,Sonstige Gebäude','Einfamilienhaus')"
);
}class Dropdown3 extends DataObject {
static $db = array(
'Dachtyp' => "Enum('Ziegel rot,Ziegel dunkel,Schiefer,Sonstige','Ziegel rot')"
);
}class Dropdown4 extends DataObject {
static $db = array(
'Anlagengroesse' => "Enum('bis 20m²,bis 30m²,bis 40m²,größer als 40m²','bis 20m²')"
);
}class Dropdown5 extends DataObject {
static $db = array(
'Standort' => "Enum('Luxemburg,Deutschland,Belgien','Deutschland')"
);
}I also get a getReferences Function within the Reference.php, there is HTML in use, but can this have an effect of the tablefield? it was the same 'error' just before i added HTMl content
(btw getReferences builds a form)
| 1542 Views | ||
|
Page:
1
|
Go to Top |

