Jump to:

7935 Posts in 1536 Topics by 943 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Is it possible to edit the ID field through the CMS?

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: 479 Views
  • BigD1214
    Avatar
    Community Member
    14 Posts

    Is it possible to edit the ID field through the CMS? Link to this post

    I am looking to add the ability to show and edit the ID field of one of my database through the data manager in the cms. Can anyone please help me out? Thanks in advanced.

  • ajshort
    Avatar
    Community Member
    244 Posts

    Re: Is it possible to edit the ID field through the CMS? Link to this post

    You can show the ID field like any other:

    $sfield->addFieldToTab('Root.Main', new ReadonlyField('ID', 'Record ID'));

    However, you can't make it editable - the ID is expected to be immutable, and is automatically generated. I can't think if a reason why you would want to make the ID editable - perhaps if you say why you need to do this an alternative solution can be found.

    Note: for some databases it would be technically possible to allow editing the ID in the CMS, but this would be a very bad idea.

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