22851 Posts in 9934 Topics by 2804 members
|Go to End|
26 August 2013 at 11:09am Last edited: 26 August 2013 11:15am
Uncle Cheese's wonderful SS3.1 module silverstripe-gridfield-betterbuttons which furnishes "Save" "Save And..." and "Delete" still suffers from the confounding Silverstripe perplexity of the fact that you have to save the record first to make those buttons appear.
The purists will have it that until then the record does not exist. However to the average user, just uploading the image IS the record, nothing more, so a double action is illogical and unnecessary.
I decided that I would save the new image object the moment the upload field is instantiated. The fact that I will get left with empty object if the process is abandoned is far less confusing that the alternative.
This is from my SlideImage.php class which has a has_many on all page types (from Page.php)
$imageField = new UploadField('Image','Choose Images');
The snag is that it doesn't work. It looks as though it's going to, but the write() makes the object vanish and then I get the classic can't handle suburls in the upload chooser when I choose from files.
So how does one do a an "autosave" properly upon instantiation of this form without the user knowing? It must be possible and I am sure many would want this. However this is where the form objects get very confusing and I need someone of Uncle Cheese's calibre to guide me!
Simple, effective and probably contrary to all the purists thinking but it means that the Uncle Cheese buttons "Save", "Save And..." and "Delete" appear immediately which is what Mr and Mrs Editor will expect.
Hope this helps
26 August 2013 at 11:51am
This may well be mentioned in
Although I cant see any difference in 3.1rc1
26 August 2013 at 1:42pm
The use of https://github.com/colymba/GridFieldBulkEditingTools makes light of this issue though and to my amazement even gives me bulk edit of all the ancillary data that goes along with my images (like caption position and so on). I have to confess I would not have expected that to work out of the box!
|Go to Top|