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.

Customising the CMS /

SS3 ModelAdmin - Display blank form after create


Reply


2 Posts   399 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, 1132 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