Jump to:

23377 Posts in 18296 Topics by 2867 members

General Questions

SilverStripe Forums » General Questions » HasOneComplexTableField - Suppress editing

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 1136 Views
  • Krigu
    Avatar
    Community Member
    7 Posts

    HasOneComplexTableField - Suppress editing Link to this post

    Hi

    I'm trying to disable the possibility to add/edit the datas of my "second object" in my HasOneComplexTableField. All I want is that the user can select one record from the second object of my one to one relationship. When I call setDisabled(true), I can't select a record anymore.

    Any help would be appreciated

    Thanks

  • Willr
    Avatar
    Forum Moderator
    5490 Posts

    Re: HasOneComplexTableField - Suppress editing Link to this post

    Perhaps use the setPermissions(array()) to set the permissions to nothing. (no add / edit).

  • swaiba
    Avatar
    Forum Moderator
    1785 Posts

    Re: HasOneComplexTableField - Suppress editing Link to this post

    Hi,

    I've added...

          $hasOneCTF = new HasOneComplexTableField($this,'Purchaser','Purchaser');
          $hasOneCTF->setPermissions(array('edit','show'));
          $fields->addFieldToTab("Root.Purchaser", $hasOneCTF);

    ..to allow users to edit a fixed has_one object. But it shows a radio button (that seems to act like a checkbox) on the left of the one record that would allow unsetting the relationship. Is it possible to remove this as the user should not be allowed to do this!

    Any information is greatly appreciated!

  • swaiba
    Avatar
    Forum Moderator
    1785 Posts

    Re: HasOneComplexTableField - Suppress editing Link to this post

    gotcha...

    $hasOneCTF->Markable = false;

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