Copied to clipboard

Flag this post as spam?

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


  • Brian McBride 3 posts 23 karma points
    Aug 29, 2014 @ 23:22
    Brian McBride
    0

    Adding Custom Properties to Umbraco Contour Forms

    Is it possible to add custom properties to contour forms?  For example, I have a requirement that each week a new form needs to be displayed on the home page.  I would like to add two date properties to my forms, StartDate and EndDate.  These would be set by the content admins when they create the forms.  When a user visits the home page I would then query for the first form where today's date falls between the StartDate and EndDate property.  Thanks.

  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Aug 29, 2014 @ 23:34
    Nicholas Westby
    0

    You can add default values to fields in Contour. You could have the content admins create their forms with two hidden fields: start date and end date. They would set default values on those fields with appropriate dates. You could then use the Contour API to search the forms and choose one based on the default values of those fields.

    If that doesn't work, you apparently can create custom fields: http://www.nibble.be/?p=154 (also see http://our.umbraco.org/forum/umbraco-pro/contour/38385-Custom-Field-Type-in-V3 )

  • Brian McBride 3 posts 23 karma points
    Sep 02, 2014 @ 17:25
    Brian McBride
    0

    I do not want to save the StartDate and EndDate with every form submission.  The properties mentioned above would be stored with the form definition itself, not with saved instances of the form.

  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Sep 04, 2014 @ 06:48
    Nicholas Westby
    0

    Note that the default value is stored with the form itself. It just so happens that a side effect is that it would also be stored with each record.

    However, if you didn't want to go with the default value route (it's a bit hacky), the above links I posted for custom fields seems like they could be used to render a custom control. There's nothing that says the data for that field must be stored with each form submission (well, it would, but it would be an empty field). You could create an arbitrarily complex control and store the data where you like.

    However, for simplicity, it may be easier just to create a separate Umbraco property editor that you'd use in the content section that allows you to associate whatever data you want with Contour forms. Or you could create a whole dashboard for that purpose.

    I have an example of a dashboard here: https://github.com/rhythmagency/rhythm.umbraco.data-processor

    The Umbraco 7 version of that is here (though there are no screenshots on this one): https://github.com/rhythmagency/rhythm.umbraco7.data-processor

Please Sign in or register to post replies

Write your reply to:

Draft