silverstripe / silverstripe-framework

Silverstripe Framework, the MVC framework that powers Silverstripe CMS
https://www.silverstripe.org
BSD 3-Clause "New" or "Revised" License
721 stars 821 forks source link

CMSForm validator breaks UI #4174

Closed georgebotley closed 9 years ago

georgebotley commented 9 years ago

Hello,

When working on a new module, I have a subclass of LeftAndMain for a Ecommerce Settings page. All functionality works fine and as intended when using CMSForm, but if you create a Validator for the form (as per the parent of CMSForm) the validator notices the form fields aren't completed, displays the standard Validation Error Pjax popup but the UI completely breaks.

The Root tabs and the breadcrumbs bar disappear, the Left of LeftAndMain sometimes vanishes, the actions buttons disappear and scrolling of the Root.Main is unavailable. I attach a screenshot of what I mean.

I have been looking through what controls this Validation Error to see if I can subclass to change any behaviour but I can't see where and Ajax requests are made within the CMS for Validation on CMSForm but it looks as though it calls the incorrect RenderWith??

Any ideas?

screen-shot-2015-05-09-at-15 11 19 screen-shot-2015-05-09-at-15 13 31

chillu commented 9 years ago

I think you'll need to set a "response negotiator" in your CMSForm implementation, see CMSMain->getEditForm(): $form->setResponseNegotiator($this->getResponseNegotiator())