Comments (4)
Yeah, that's been like that for some time now and we had users complaining about it as well. Since our validation was usually simple we asked them to populate those required fields and then archive it.
from silverstripe-cms.
There’s a method in Form
called setValidationExemptActions()
(or something similar) - do we just need to add the archive action to that?
from silverstripe-cms.
There’s a method in
Form
calledsetValidationExemptActions()
(or something similar) - do we just need to add the archive action to that?
Already tried that... seems that when the archive action kicks in the validationExemptActions
array is empty.
from silverstripe-cms.
silverstripe-cms/code/Controllers/CMSMain.php
Lines 1379 to 1388 in de8d763
CMSMain
does this for SiteTree
(or, more specifically, does it for the edit form most typically used for SiteTree
), which is why this doesn't happen for pages.
DataObject
subclasses are most typically edited using a gridfield, which means the form that needs this treatment is the one produced by GridFieldDetailForm_ItemRequest::ItemEditForm()
.
You should be able to work around this by adding the following extension to GridFieldDetailForm_ItemRequest
:
class GridFieldValidationExcemptExtension extends Extension
{
public function updateItemEditForm(Form $form): void
{
$form->setValidationExemptActions([
'doArchive',
// You probably want to also add other actions like delete, restore, etc
]);
}
}
Ideally this will be done in core directly in GridFieldDetailForm_ItemRequest::ItemEditForm()
through a PR. If someone wants to do that I'd be happy to look at it.
from silverstripe-cms.
Related Issues (20)
- Refactor CMSMain and its subclasses HOT 1
- TODO: Should ContentController::LoginForm() return all available log-in forms? HOT 1
- [bug] Bulk actions allow unpublishing of homepage without confirmation
- 5.1: Can't open settings tab of SiteTree objects, if you have a lot of members HOT 12
- Redirector page in Menu does not return expected isCurrent() value. HOT 1
- Insert from Files button not working in TinyMCE editor HOT 4
- Jumping to random CMS tabs when navigating pages HOT 3
- TinyMCE - Adding a link to a page on this site and then clicking through to the immediate child pages takes you down two levels rather than one HOT 1
- SPIKE Analyse how LeftAndMain and CMSMain are put together and how they could work better HOT 7
- Form field validation/error doesn't highlight the tab where the error occurred HOT 2
- Don't hardcode `SiteTree` in `CMSMain`
- Refactor history tab `CMSMain`/`HierarchyModelAdmin`
- Refactor tree filtering in `CMSMain`/`HierarchyModelAdmin`
- Refactor batch actions in `CMSMain`/`HierarchyModelAdmin`
- Make an abstract class for managing hierarchical data in a tree view
- Refactor `ModelAsController` to be generic
- Refactor `ContentController` to be generic
- Refactor `RootURLController` to be generic
- Remove old installer logic from ContentController HOT 1
- Duplicate breadcrumb labels when navigating site tree in ListView HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from silverstripe-cms.