I'm very interested as to how best to solve this too. Previously I've used your first suggestion by way of an event handler on BeforePublish, and returning any validation descriptions in the baloon popup, but this was far from ideal, so ended up building a self contained datatype with all the fields to be validated together.
I'm not sure how a custom datatype could work, unless it did it's work client side, but then it'd have to know the inner workings of the other types to be validated.
3) Custom - just a datatype that includes all the necessary inputs, and by so having full control over them. But then again - the individual prop values would need some extra parsing using them later on.
Perhaps a custom "javascript datatype" that simply renders a js defined in the documenttype, and that one will have the client side (jQuery) validation code. (hackish)
Custom validation on document save
I need to make a custom validation for documents (something like property1.value>property2.value). I come to think of two options:
1) hook up to the save event and check the properties serverside. But can I send a validation message from there to the UI?
2) perform validation with a jQuery-hack.
3) make a custom data type (I'd rather not since I like the straight forward way of getting plain property data from nodes).
Any thoughts about this?
Thanks!
/ Jonas
Hi Jonas,
I'm very interested as to how best to solve this too. Previously I've used your first suggestion by way of an event handler on BeforePublish, and returning any validation descriptions in the baloon popup, but this was far from ideal, so ended up building a self contained datatype with all the fields to be validated together.
I'm not sure how a custom datatype could work, unless it did it's work client side, but then it'd have to know the inner workings of the other types to be validated.
Cheers,
Hendy
Hi Hendy, thanks for your input
1) I see. Yeah the good ol' balloon...
3) Custom - just a datatype that includes all the necessary inputs, and by so having full control over them. But then again - the individual prop values would need some extra parsing using them later on.
Perhaps a custom "javascript datatype" that simply renders a js defined in the documenttype, and that one will have the client side (jQuery) validation code. (hackish)
Cheers,
Jonas
is working on a reply...