Jump to:

7935 Posts in 1536 Topics by 943 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » HasManyComplexTableField popup - tickbox problems

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 822 Views
  • bones
    Avatar
    Community Member
    104 Posts

    HasManyComplexTableField popup - tickbox problems Link to this post

    We're using HasManyComplexTableField to add items to a banner. The banner is used on multiple pages, and we've found that when we add something on one page, it also appears on the others (which is great) but with the tick boxes greyed-out so we can't enable that item on other pages (only on the original page).

    Can anybody either help us to "enable" the checkboxes on all pages, or have them ticked by default (we're happy for the same content to appear on each page).

    Thanks.

  • Plato
    Avatar
    Community Member
    26 Posts

    Re: HasManyComplexTableField popup - tickbox problems Link to this post

    You have the wrong kind of relation set on your data objects.

    The reverse of a has_many is a has_one. As each of your banners can only have one page, they are greyed out so that you cannot select them on other pages once they've already been associated to a page.

    HasManyComplexTableField is largely redundant (along with HasOneComplexTableField), you can just use ComplexTableField and it'll automatically take care of things for you (as by default CTF's are made for handling many related items).

    However what you're actually wanting by the sounds of it is a many_many relation, to which the reverse is belongs_many_many on your banners. This way you can have one banner on many pages, with each page having many banners (not necessarily the same ones).

  • bones
    Avatar
    Community Member
    104 Posts

    Re: HasManyComplexTableField popup - tickbox problems Link to this post

    Yes, that's fixed it. $many_many_thanks for your help ;)

    822 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.