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.

Data Model Questions /

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

Show Tab or Field after Saving - DataObject

Go to End

4 Posts   1283 Views


Community Member, 11 Posts

29 November 2013 at 1:15am

Edited: 29/11/2013 1:15am

Hi everybody,

I got a DataObject with some has_many Relations. I know, that the DataObject has to be saved first, before you can add the related Object with a Gridfield (like you have to save first before you can add Images with a Uploadfield).

My Question is, if I can hide the Gridfield and/or the Tab where my Gridfield is in until the DataObject is saved. So that the Editor doesn't get confused.

How does the UploadField work, which first shows a message and after saving the Dataobject shows the possibility to Upload?

Thanks in advance,


Forum Moderator, 1390 Posts

5 December 2013 at 1:13am

i don't know if this would work, but just maybe you could hide the field in the DataObjects getCMSFields() if the $this->ID is empty?



Community Member, 545 Posts

7 December 2013 at 3:58pm

I'm pretty sure as of 3.1.x creating a new DataObject creates a draft object so you can actual do relations before saving at least for images. I wrap the fields I want to hide in if $this->ID != 0 since the draft object actually has an ID of 0.


Community Member, 11 Posts

11 January 2014 at 12:55am

Thank you both.
Everything works fine now.
Wrapped my Tabs and fields in:

if ($this->ID != 0){