Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

ImageField in ComplexTableField


Go to End


1103 Views

Avatar
Paco728

Community Member, 28 Posts

18 July 2011 at 4:47pm

please help, I get this message to want to attach a picture from the popup in a complextablefield "Images can be attached once you have saved the record for the first time." and I see no error in the code

NuevoTorneo.php

$newsTablefield = new ComplexTableField(
$this,
'MiNoticia',
'Noticias',
array(
'titulo_not' => 'Titulo',
'Cont_not' => 'Contenido',
'img_not' => 'Imagen',
),
'getCMSFields_forPopup'
);
$newsTablefield->setAddTitle( 'noticia' );

$fields->addFieldToTab( 'Root.Content.Noticias', $newsTablefield );

..................................................................................................................................................................................................................

Noticias.php (dataobject)

static $db = array(
'titulo_not' => 'Text',
'Cont_not' => 'Text'
);

static $has_one = array(
'MiTorneo' => 'NuevoTorneo',
'img_not' => 'Image'
);

function getCMSFields_forPopup() {
$fields = new FieldSet();
$fields->push( new TextField( 'titulo_not','Titulo' ) );
$fields->push( new TextareaField( 'Cont_not','Contenido' ) );
$fields->push( new ImageField( 'img_not','Imagen' ) );
return $fields;
}

Attached Files