Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Validation in DataObjectManager_Popup


Reply


7 Posts   1080 Views

Avatar
Mad_Clog

Community Member, 78 Posts

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??

Avatar
UncleCheese

4085 Posts

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.

Avatar
Mad_Clog

Community Member, 78 Posts

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();

Avatar
UncleCheese

4085 Posts

10 June 2010 at 3:40am

Yup. That's some old code you're looking at.

Avatar
Mad_Clog

Community Member, 78 Posts

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?

Avatar
Mad_Clog

Community Member, 78 Posts

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();

Avatar
Mad_Clog

Community Member, 78 Posts

13 August 2010 at 6:14am

*bump*
This still needs to be patched in

      parent::__construct($controller, $name, $fields, $actions, $validator);
      if ($this->validator instanceof Validator) {
         $this->validator->setJavascriptValidationHandler('none');
      } else {
         $this->unsetValidator();
      }