Jump to:

7939 Posts in 1472 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » How to show value instead of ID# with CheckboxsetField

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: 446 Views
  • woodb2
    Avatar
    Community Member
    48 Posts

    How to show value instead of ID# with CheckboxsetField Link to this post

    I've been struggling with CheckboxsetField and I thought I had it working (backend works great). When I view the page in the frontend I'm getting ID numbers instead of the values.

    I have a Department page that is a $many_many relation to Jobs which is a DataObject

    In Jobs my CheckboxsetField looks great, it displays all the Department pages that I've created, but it stores ID# not the titles.

    $Rolesob = DataObject::get('Department');

          $fields->addFieldToTab('Root.ASIA', new CheckboxsetField('ASIA', 'ASIA (create Department Page first)', $Rolesob));

    On my template $ASIA displays 154,156 instead of Accounting, Human Resources

    How can I get the values to display?

    Any help is appreciated.

    Brian

  • UncleCheese
    Avatar
    4085 Posts

    Re: How to show value instead of ID# with CheckboxsetField Link to this post

    $Rolesob->toDropdownMap('ID','YourLabelField');

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