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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Keep the same DataObject after save during new entry


Go to End


5 Posts   2190 Views

Avatar
Jakxnz

Community Member, 36 Posts

6 May 2011 at 8:56am

Hey SS Crew,

When using the DataObjectManager (and entering a new DataObject), after you click the save button, the current DataObject is entered into the db successfully but the DataObjectManager popup doesnt maintain the newly entered information after the intial save.
Instead you have to close the popup, wait for the Table to refresh and then re-open your newly entered DataObject.

Is there any setting to keep the current (newly added) DataObject in view after you click save?

Avatar
teejay

Community Member, 63 Posts

8 June 2011 at 1:07pm

I am looking for the same thing right now. I ll let you know if I find something.

Avatar
teejay

Community Member, 63 Posts

8 June 2011 at 1:25pm

in DataObjectManger.php on line 300 (vague) there is a check if the form has file fields this check does not seem to work for image/file fields. I suppose u have the same problem that you use an image/file object. The code clearly tells me that if there is file field please maintain the record. But it doesnt with image fields.

if($form->getFileFields() || $form->getNestedDOMs()) {
$form->clearMessage();
Director::redirect(Controller::join_links($this->BaseLink(),'item', $childData->ID, 'edit'));
}

U can now get rid of the if u want but hacking the source is always pain. So maybe uncle cheese has something to say here :).

Avatar
teejay

Community Member, 63 Posts

8 June 2011 at 1:36pm

I guess if u change line 854 in dataobject manager with this

++foreach($this->Fields()->dataFields() as $field) {
--foreach($this->Fields() as $field) {

this should fix ur problem I guess.

Avatar
UncleCheese

Forum Moderator, 4102 Posts

11 June 2011 at 3:37am

There might be reason to make this behaviour configurable, but personally, I really like that the form advances to add another record when creating. There's not much point in showing me what I just got done entering. In my experience, people like to create content in bulk -- not one at at time.

I think ideally we just have two buttons -- save, and save & add.

--------------------
SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com