Forums / Developer / Multiple attribute validation rules for custom datatypes

Multiple attribute validation rules for custom datatypes

Author Message

Piotrek Karaś

Thursday 20 December 2007 10:42:14 am

Does anyone have any experience with creating complex validation rules for their custom datatype, so that they actually access other attributes of the same object being edited/created and validate their values or even their combinations? For example, let's image a class attribute based on custom datatype, whose only purpose is to check whether value of two other attributes have certain presupposed values.

Is it even possible to reach out of the validateObjectAttributeHTTPInput method of datatype definition class towards other attributes? Or maybe should this be done at some other stage?

I'd be grateful for any pointers!

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Heath

Thursday 20 December 2007 1:59:00 pm

Hello Piotrek,

I have seen contributions along similar topics. It might be useful to know if you have examined these existing contributions and if they meet your needs.

http://projects.ez.no/objectvalidation
http://projects.ez.no/bcicfv

Cheers,
Heath

Brookins Consulting | http://brookinsconsulting.com/
Certified | http://auth.ez.no/certification/verify/380350
Solutions | http://projects.ez.no/users/community/brookins_consulting
eZpedia community documentation project | http://ezpedia.org

Piotrek Karaś

Thursday 20 December 2007 2:17:54 pm

Hi Heath,

Thanks for the tips - I actually forgot to look for solutions within the projects site.

Especially Kristof's objectvalidation seems interesting, but unfortunately it's not available for download... or maybe it is for logged in users, but I don't happen to have an account there... If you have one, could you please check it for me?

As for as my own investigation...

Even if I cannot perform validation on the object level, the attribute level and validation methods perfectly see POST variables, so there's a bit of possibilities there.

Also, one of the things that I may need is a change-protected text line or integer. Since I have to be 100% sure that it remains unchanged from the moment of object's creation through all the editing sessions, I was thinking about a datatype that would check a hash of the value and some unique data, for example: sha1($sessionID.$salt.$attributeValue.$contentObjectID). This should be difficult to skip and also to somehow forge. We'll see how it works, it's just a concept for now ;)

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Heath

Thursday 20 December 2007 2:29:33 pm

Hello Piotrek,

Ask Kristof for an account, I'm certain he would accommodate you with an account ;)

Still, you don't have to wait to have an account to checkout a copy of his extension! Simply use subversion to checkout the extension from the svn repository located at ...

<i>http://svn.projects.ez.no/objectvalidation/trunk/extension/objectvalidation/</i>

Cheers,
Heath

Brookins Consulting | http://brookinsconsulting.com/
Certified | http://auth.ez.no/certification/verify/380350
Solutions | http://projects.ez.no/users/community/brookins_consulting
eZpedia community documentation project | http://ezpedia.org

Piotrek Karaś

Thursday 20 December 2007 2:34:56 pm

;)

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu