Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • James Crane 34 posts 80 karma points
    Aug 03, 2009 @ 17:45
    James Crane
    0

    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

  • Richard Soeteman 4036 posts 12864 karma points MVP
    Aug 03, 2009 @ 20:48
    Richard Soeteman
    0

    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

  • James Crane 34 posts 80 karma points
    Aug 04, 2009 @ 09:18
    James Crane
    0

    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

  • Rick Mather 42 posts 124 karma points
    Aug 04, 2009 @ 10:50
    Rick Mather
    0

    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.

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Aug 04, 2009 @ 10:54
    Thomas Höhler
    0

    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

  • James Crane 34 posts 80 karma points
    Aug 04, 2009 @ 18:03
    James Crane
    0

    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

Please Sign in or register to post replies

Write your reply to:

Draft