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.

General Questions /

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

HasOneComplexTableField - Suppress editing


Reply


4 Posts   1164 Views

Avatar
Krigu

Community Member, 7 Posts

29 April 2010 at 6:41am

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

Avatar
Willr

Forum Moderator, 5513 Posts

29 April 2010 at 11:47pm

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

Avatar
swaiba

Forum Moderator, 1798 Posts

19 November 2010 at 2:36am

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!

Avatar
swaiba

Forum Moderator, 1798 Posts

19 November 2010 at 2:43am

gotcha...

$hasOneCTF->Markable = false;