7913 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » Validation in DataObjectManager_Popup
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 942 Views |
-
Validation in DataObjectManager_Popup

10 June 2010 at 2:55am
I need some custom validation in a popup, but in the code the validator get unset specifically.
File: DataObjectManager.php
Line: 792
Code: $this->unsetValidator();Why is this??
-
Re: Validation in DataObjectManager_Popup

10 June 2010 at 3:14am
Javascript conflicts.. that validator brings in prototype and all sorts of junk. You can try enabling it again, but I've never had any luck with it. Much better to use jQuery based validation.
-
Re: Validation in DataObjectManager_Popup

10 June 2010 at 3:33am
Wouldn't it be better to just disable the javascript validation handler in that case?
Then you could atleast still use server side validation$validator->setJavascriptValidationHandler('none');
parent::__construct($controller, $name, $fields, $actions, $validator);
// $this->unsetValidator(); -
Re: Validation in DataObjectManager_Popup

10 June 2010 at 3:40am
Yup. That's some old code you're looking at.
-
Re: Validation in DataObjectManager_Popup

10 June 2010 at 3:45am
I'm using the latest version of DOM from the trunk.
Are you going to include this in your next release? -
Re: Validation in DataObjectManager_Popup

17 June 2010 at 1:12am
Here's an updated code snippet which i think should be included in the DOM
// disable javascript validation to prevent JS errors
if (!empty($validator) && $validator instanceof Validator) {
$validator->setJavascriptValidationHandler('none');
}
parent::__construct($controller, $name, $fields, $actions, $validator);
// $this->unsetValidator(); -
Re: Validation in DataObjectManager_Popup

13 August 2010 at 6:14am
*bump*
This still needs to be patched inparent::__construct($controller, $name, $fields, $actions, $validator);
if ($this->validator instanceof Validator) {
$this->validator->setJavascriptValidationHandler('none');
} else {
$this->unsetValidator();
}
| 942 Views | ||
|
Page:
1
|
Go to Top |

