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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

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

Identify show and edit forms


Go to End


4 Posts   1821 Views

Avatar
cardinale

Community Member, 23 Posts

22 March 2010 at 9:40pm

Edited: 22/03/2010 9:42pm

How can I know if the actual form is edit or show ?

function getCMSFields() {
$fields = parent::getCMSFields();

// This is working for add form:

if( !$this->ID ) {
// form = add
// https://www.xy.de/admin/Modeladmin/Depositaer/5/EditForm/field/News/add
}

// This is NOT working for show form:

if( $this->action == 'show' ) {
// form = show
// https://www.xy.de/admin/Modeladmin/Depositaer/5/EditForm/field/News/item/12/show
}

return $fields;
}

Avatar
cardinale

Community Member, 23 Posts

26 March 2010 at 10:27pm

Hello,
I'm looking since 4 days for the solution and will be very happy if someone could help me.

Avatar
Willr

Forum Moderator, 5523 Posts

27 March 2010 at 4:04pm

Are you referring to cms fields in the site tree or in a form such as model admin?

Avatar
cardinale

Community Member, 23 Posts

27 March 2010 at 10:02pm

Thanks Willr,
my form is in the model admin!