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 DOM


Reply

2 Posts   578 Views

Avatar
Stef87

17 November 2012 at 6:34am Community Member, 66 Posts

SilverStripe 2.4.7

Hi

I'm looking for a way to validate the fields in my DOM popup. I need to, firstly, ensure that they have all been filled in. Next I need to make sure they are correct using Regular Expressions or something. I am ok with the regex but how do I go about applying validation to the fields?

Thanks

Avatar
Stef87

20 November 2012 at 10:43pm (Last edited: 21 November 2012 1:00am), Community Member, 66 Posts

I've been trying to implement what these posts talk about but it has no effect.

http://www.silverstripe.org/data-model-questions/show/6128
http://www.silverstripe.org/customising-the-cms/show/8236

Even basic validation using the following does nothing.

public function getCMSValidator() {
   return new RequiredFields(array('Title', 'Expires', 'Photo', 'Description', 'Weight', 'Price', 'Savings', 'Code'));
   }

When I try to add a new popup class I get this error

Class 'MyDataObjectManager_Popup' not found in /Applications/MAMP/htdocs/Gala/Gala/trunk/cms/sapphire/forms/ComplexTableField.php on line 600

I'm using

MyDOM->popupClass = 'MyDataObjectManager_Popup';