Merge pull request #2514 from ajshort/pull-4

CMS Validation
This commit is contained in:
Simon Welsh 2013-10-09 18:45:43 -07:00
commit c6c187b083
2 changed files with 10 additions and 3 deletions

View File

@ -28,9 +28,16 @@ class CMSForm extends Form {
protected function getValidationErrorResponse() {
$request = $this->getRequest();
$negotiator = $this->getResponseNegotiator();
if($request->isAjax() && $negotiator) {
$negotiator->setResponse(new SS_HTTPResponse($this));
return $negotiator->respond($request);
$this->setupFormErrors();
$result = $this->forTemplate();
return $negotiator->respond($request, array(
'CurrentForm' => function() use($result) {
return $result;
}
));
} else {
return parent::getValidationErrorResponse();
}

View File

@ -93,7 +93,7 @@
var firstTabWithErrors = this.find('.message.validation:first').closest('.tab');
$('.cms-container').clearCurrentTabState(); // clear state to avoid override later on
this.redraw();
firstTabWithErrors.closest('.cms-tabset').tabs('select', firstTabWithErrors.attr('id'));
firstTabWithErrors.closest('.ss-tabset').tabs('select', firstTabWithErrors.attr('id'));
}
this._super();