Jump to:

5540 Posts in 1738 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » ComplexTableField: Why don't work?

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

Page: 1
Go to End
Author Topic: 1104 Views
  • biapar
    Avatar
    Forum Moderator
    435 Posts

    ComplexTableField: Why don't work? Link to this post

    Hi,

    I've into a class extends LeftAndMain
    ....
    function getEditForm() {
       
    $editor = new ComplexTableField(
    $this,
    'ContactFormSubmissions',
    'ContactFormSubmission',
    array('Name','Surname'),

    );
    $editor->setParentClass(false);

    $myTableField= ...

    $fields= new FieldSet($myTableField,$editor);

             $actions = new FieldSet(
                new FormAction('doSaveLink', 'Salva')
             );

    $form = new Form($this, "EditForm", $fields, $actions,null);

    return $form;
    }
    function ContactFormSubmissions() {
    return DataObject::get('ContactFormSubmission');
    }

    }

    but at runtime I've thie error:

    [Notice] Array to string conversion

    Trace

    * strpos(Array,()
    Line 268 of ViewableData.php
    * ViewableData->castingClass(0)
    Line 374 of ViewableData.php
    * ViewableData->obj(0,,,)
    Line 446 of ViewableData.php
    * ViewableData->XML_val(0)
    Line 1341 of TableListField.php
    * TableListField_Item->Fields()
    Line 369 of ViewableData.php
    * ViewableData->obj(Fields)
    Line 589 of .cacheC..xampp.htdocs.ss242.sapphire.templates.ComplexTableField.ss
    * include(C:\Windows\Temp\silverstripe-cacheC--xampp-htdocs-ss242\.cacheC..xampp.htdocs.ss242.sapphire.templates.ComplexTableField.ss)
    Line 420 of SSViewer.php
    * SSViewer->process(ComplexTableField)
    Line 342 of ViewableData.php
    * ViewableData->renderWith(ComplexTableField)
    Line 275 of ComplexTableField.php
    * ComplexTableField->FieldHolder()
    Line 369 of ViewableData.php
    * ViewableData->obj(FieldHolder,,,1)
    Line 446 of ViewableData.php
    * ViewableData->XML_val(FieldHolder,,1)
    Line 77 of .cacheC..xampp.htdocs.ss242.sapphire.templates.Includes.Form.ss
    * include(C:\Windows\Temp\silverstripe-cacheC--xampp-htdocs-ss242\.cacheC..xampp.htdocs.ss242.sapphire.templates.Includes.Form.ss)
    Line 420 of SSViewer.php
    * SSViewer->process(Form)
    Line 342 of ViewableData.php
    * ViewableData->renderWith(Array)
    Line 1085 of Form.php
    * Form->forTemplate()
    Line 447 of ViewableData.php
    * ViewableData->XML_val(EditForm,,1)
    Line 12 of .cacheC..xampp.htdocs.ss242.mysite.code.templates.DispoAdmin_right.ss
    * include(C:\Windows\Temp\silverstripe-cacheC--xampp-htdocs-ss242\.cacheC..xampp.htdocs.ss242.mysite.code.templates.DispoAdmin_right.ss)
    Line 420 of SSViewer.php
    * SSViewer->process(DispoAdmin)
    Line 342 of ViewableData.php
    * ViewableData->renderWith(Array)
    Line 485 of LeftAndMain.php
    * LeftAndMain->Right()
    Line 369 of ViewableData.php
    * ViewableData->obj(Right,,,1)
    Line 446 of ViewableData.php
    * ViewableData->XML_val(Right,,1)
    Line 71 of .cacheC..xampp.htdocs.ss242.cms.templates.LeftAndMain.ss
    * include(C:\Windows\Temp\silverstripe-cacheC--xampp-htdocs-ss242\.cacheC..xampp.htdocs.ss242.cms.templates.LeftAndMain.ss)
    Line 420 of SSViewer.php
    * SSViewer->process(DispoAdmin)
    Line 202 of Controller.php
    * Controller->handleAction(SS_HTTPRequest)
    Line 137 of RequestHandler.php
    * RequestHandler->handleRequest(SS_HTTPRequest)
    Line 147 of Controller.php
    * Controller->handleRequest(SS_HTTPRequest)
    Line 281 of Director.php

    Why? Thank you

  • biapar
    Avatar
    Forum Moderator
    435 Posts

    Re: ComplexTableField: Why don't work? Link to this post

    ?

  • AlphaCactus
    Avatar
    Community Member
    11 Posts

    Re: ComplexTableField: Why don't work? Link to this post

    The way I figured out where the problem was, was do temporarily add

    Debug::show( $child );
    Debug::show( $name );
    Debug::show( $child->Name() );


    to the dataFieldByName function that was throwing the error. That quickly showed me that somehow one of my field names was in fact totally screwed up and also coincidentally an array.

    1104 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.