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

Creating a multi step process in admin


Go to End


2 Posts   1035 Views

Avatar
lozhowlett

Community Member, 151 Posts

23 July 2013 at 5:22am

Hi

I want to create a 3 step process is the admin system, which is going to take some serious customisation.

Step 1: Select venue and enter event details
Step 2: Select dates for the event
Step 3: Select car parks available for event and set pricing

Is this even possible? Thanks

Avatar
ajthenewguy

Community Member, 1 Post

25 July 2013 at 4:15pm

That might actually be pretty easy, just use conditionals on the getCMSFields function, check for fields set, and depending on which ones are already set, present a different set of fields.

$StepOneFields = new CompositeField(
new DropdownField('VenueID', 'Venue', Venu::get()->map())
);

$StepTwoFields = new CompositeField(
new GridField('Dates', 'Dates', $this->Dates())
);

$StepThreeFields = new CompositeField(
new GridField('CarParks', 'Car Parks', CarParks::get()->map())
);

if( !$this->ID ) $fields->addFieldToTab('Root.Main', $StepOneFields);
elseif( $this->ID && $this->VenueID ) $fields->addFieldToTab('Root.Main', $StepTwoFields);
elseif( $this->ID && empty($this->CarParks()) ) $fields->addFieldToTab('Root.Main', $StepThreeFields);
else // Add all 3 CompositeFields to FieldList