In the short term you can set the validator manually when you create the GridField
$grid = new GridField('MyObject', 'My Objects', $this->MyObjects(), GridFieldConfig_RecordEditor::create());
$grid->getConfig()->getComponentByType('GridFieldDetailForm')
->setValidator(singleton('MyObject')->getCMSValidator());
$fields->addFieldToTab('Root.Main', $grid);
@HARVS1789UK, that seems slightly messy. A cleaner way would be a patch something like below to the detail form. If that patch makes everyone happy, I can push to framework.
Note I've keep getCMSValidator as this is what ModelAdmin uses. Another suitable patch would be to introduce checking for both getCMSValidator and getValidator.
diff --git a/forms/gridfield/GridFieldDetailForm.php b/forms/gridfield/GridFieldDetailForm.php
index 108af99..188565c 100644
--- a/forms/gridfield/GridFieldDetailForm.php
+++ b/forms/gridfield/GridFieldDetailForm.php
@@ -90,6 +90,12 @@ class GridFieldDetailForm implements GridField_URLHandler {
$handler = Object::create($class, $gridField, $this, $record, $controller, $this->name);
$handler->setTemplate($this->template);
+ // if no validator has been set on the GridField and the record has a
+ // CMS validator, use that.
+ if(!$this->getValidator() && method_exists($record, 'getCMSValidator')) {
+ $this->setValidator($record->getCMSValidator());
+ }
+
return $handler->handleRequest($request, DataModel::inst());
}