One final issue I'm experiencing is how to fire the mandatory field warning. Currently the default item is 'Please select...'. I have set this to a value of -1 which didn't fire the mandatory field warning, and then tried setting it to nothing - which raised an int wrong data error.
Don't know for sure, but try to set the value to an empty string instead? It's checking for an empty field and since your value is not empty and you can't set the defaultvalue on the validator, so I think that's what you need to do, again not sure.
Thanks for you comments, unfortunately this raises a data type exception as it's expecting an int but gets a null. I think I probably need to assess in code if the field is completed or not and then raise a failed validation event, but I'm sturggling to find out!
This is only a guess really, but in normal ASP.NET you can make custom controls compatible with validators by using the 'ValidationProperty' attribute:
Creating customised datatypes
Hi all,
I've created a customised dropdown datatype, listing all the child nodes under a parent. This was based on the excellent article:
http://www.nibble.be/?p=24
One final issue I'm experiencing is how to fire the mandatory field warning. Currently the default item is 'Please select...'. I have set this to a value of -1 which didn't fire the mandatory field warning, and then tried setting it to nothing - which raised an int wrong data error.
As always, any help is appreciated.
JC
Don't know for sure, but try to set the value to an empty string instead? It's checking for an empty field and since your value is not empty and you can't set the defaultvalue on the validator, so I think that's what you need to do, again not sure.
Hope it helps you,
Richard
Hi Richard,
Thanks for you comments, unfortunately this raises a data type exception as it's expecting an int but gets a null. I think I probably need to assess in code if the field is completed or not and then raise a failed validation event, but I'm sturggling to find out!
Thanks
JC
This is only a guess really, but in normal ASP.NET you can make custom controls compatible with validators by using the 'ValidationProperty' attribute:
http://support.microsoft.com/kb/310082
I haven't tried this with Umbraco datatypes, and am not sure if the admin backend uses .NET validators or custom logic, but might be worth a shot.
It uses this attribute with the name of the property to validate, mostly it is "value". But I don't know how it works with the customcontrolgrapper
Will do some tests...
Thomas
I've been fiddling about with Rick's suggestion but I just can't seem to get the mandatory event field to fire.
Thomas, did you have any luck?
Thanks
is working on a reply...