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

SS3 ModelAdmin - Display blank form after create


Go to End


2 Posts   1130 Views

Avatar
pbz

Community Member, 5 Posts

20 October 2012 at 8:09am

I'm using ModelAdmin with the default form scaffolding, to manage a complicated database of related objects.

Something along the line of Company has_many Employees, each Employee has_many Notes.

When creating Notes, after clicking the Create button a nice little "Saved" message appears and the user remains on the edit form for the just created Note.

Is there a way it can be setup so the user is either taken to a blank "Create" form or the GridField listing of all Notes for that Employee after Creating a Note? This could save a lot of clicks for a user creating many Notes in a row for one Employee?

Thanks.

Avatar
martimiz

Forum Moderator, 1391 Posts

23 October 2012 at 11:48pm

I don't think there is, at the moment. The GridFieldDetailForm::doSave() redirects including the new ID, so the form will interprete it as an edit request.

It should be possible to subclass the GridFieldDetailForm and its Link() method to leave out the ID based on some condition. Then make sure the the subclass is used in the GridField :)

Martine