Copied to clipboard

Flag this post as spam?

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


  • Sean Farrow 22 posts 42 karma points
    Dec 04, 2012 @ 12:16
    Sean Farrow
    0

    Using The MemberPicker Datatype in a code first form

    Hi:

    We have just upgraded to Contour 3.

    I'm creating a form to allow a user to select another member from the site.

    How would I go about using the Umbraco MemberPicker in a code first form?

    Any help apreciated.

    Regards

    Sean.

  • Comment author was deleted

    Dec 04, 2012 @ 13:57

    Hey Sean,

    First you'll need to create a member picker field type, since that isn't available out of the box

    For some details on creating custom fieldtypes check http://www.nibble.be/?p=89

    Once that is created you should just be able to define the type in the field attribute on the code first form

  • Sean Farrow 22 posts 42 karma points
    Dec 05, 2012 @ 10:53
    Sean Farrow
    0

    Hi:

    That all makes sense, are there any examples of wrapping an existing Umbraco Data type (with prevalues) in a contour field?

    Any help apreciated.

    Regards

    Sean. 

  • Martin Griffiths 826 posts 1269 karma points c-trib
    Dec 05, 2012 @ 12:52
    Martin Griffiths
    0

    Hi Tim

    We've tried using the re-captcha fieldtype available in the contrib library but we keep getting an unknown type YSOD. Is it possible to use custom fieldtypes in code first when it inherits from FormBase and exposes only the core fields? Or have I got it wrong? lol.

    Please tell me how to get it working :-)

    M.

  • Comment author was deleted

    Dec 05, 2012 @ 13:18

    Haven't tried it but a reference to the project and then setting the type on the field attribute seems the way to go, will give it a shot

  • Comment author was deleted

    Dec 05, 2012 @ 13:27

    Just tried it and it works...

    Download the latest contour contrib source and build

    Add reference to the contour.contrib assembly in your code first project

    Add property and set type setting to recaptcha fieldtype

     [Field("Leave a comment""Your comment",
               Mandatory = true,
               Type = typeof(Contour.Contrib.FieldTypes.ReCaptcha))]
            public string Captcha { getset; }

    THen you'll need to contour contrib assembly and the recaptcha assembly on your site of course...

  • Martin Griffiths 826 posts 1269 karma points c-trib
    Dec 05, 2012 @ 13:31
    Martin Griffiths
    0

    Hi Tim

    Of course, use of correct namespaces! Doh!

    I'll let you know how it goes.

    Code first...Awesome BTW!

    Many thanks

    Martin

  • Sean Farrow 22 posts 42 karma points
    Dec 06, 2012 @ 01:15
    Sean Farrow
    0

    Hi:

    Two final questions regarding code first:

    First, is there a way to make a codefirst form multi-step?

    Second, is there a way to prevent a forms settings being stored--there being written to the database anyway and it's sensitive data! Essentially, I don't want users to be able to view data in the record viewer.

    Any help apreciated.

    Cheers

    Sean

  • Martin Griffiths 826 posts 1269 karma points c-trib
    Dec 07, 2012 @ 10:42
    Martin Griffiths
    0

    Hi Tim

    Your example worked it was spot on, but we've noticed that if you insert a form as a user control rather than a razor script an override for the Validate() method refuses to fire! Any particular reason why this would be the case?

    Martin.

Please Sign in or register to post replies

Write your reply to:

Draft