Jump to:

7935 Posts in 1536 Topics by 943 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Keep the same DataObject after save during new entry

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 963 Views
  • jdi
    Avatar
    Community Member
    34 Posts

    Keep the same DataObject after save during new entry Link to this post

    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?

  • teejay
    Avatar
    Community Member
    63 Posts

    Re: Keep the same DataObject after save during new entry Link to this post

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

  • teejay
    Avatar
    Community Member
    63 Posts

    Re: Keep the same DataObject after save during new entry Link to this post

    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 .

  • teejay
    Avatar
    Community Member
    63 Posts

    Re: Keep the same DataObject after save during new entry Link to this post

    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.

  • UncleCheese
    Avatar
    4085 Posts

    Re: Keep the same DataObject after save during new entry Link to this post

    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

    963 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.