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.

Archive /

Our old forums are still available as a read-only archive.

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

Auto-associate/Auto-check on HasManyComplexTableField


Go to End


5 Posts   8326 Views

Avatar
dashiel

Community Member, 13 Posts

4 May 2008 at 11:43am

is there anyway to automatically have the checkboxes default to checked when creating a new entry in a HasManyComplexTableField?

i'm currently filtering the results in the CMS with the $sourceFilter param, which works well, but unfortunately now if i create a new entry it doesn't even give me the option of checking it. so all new entries are hidden unless i manually edit the ID association in mysql.

Avatar
Double-A-Ron

Community Member, 607 Posts

15 June 2008 at 5:02pm

Looking for the exact same thing...

Avatar
Double-A-Ron

Community Member, 607 Posts

15 June 2008 at 5:09pm

Found the solution to this here:http://silverstripe.com/site-builders-forum/flat/45030

$tablefield->relationAutoSetting = true; after the Complex field declaration fixes the issue.

Avatar
cinek

Community Member, 17 Posts

15 June 2008 at 5:55pm

Edited: 15/06/2008 5:56pm

Maybe what you need is ComplexTableField? It displays only items associated with your page, i.e. there are no checkboxes (there is a 'delete' button) and items are automatiacally added to relationship when created.

Avatar
Double-A-Ron

Community Member, 607 Posts

16 June 2008 at 1:45pm

Good tip Cinek. That worked well.