7956 Posts in 1394 Topics by 945 members
|Go to End|
31 May 2012 at 1:30am
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).
31 May 2012 at 4:45pm
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).
2 June 2012 at 12:58am
Yes, that's fixed it. $many_many_thanks for your help ;)
|Go to Top|