Copied to clipboard

Flag this post as spam?

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


  • GUILLAUME GIRARD 2 posts 72 karma points
    May 19, 2017 @ 09:50
    GUILLAUME GIRARD
    0

    Umbraco Forms: response number quota

    Hello,

    We are starting to use Umbraco Forms with the latest version (Forms 6.0.1).

    We need to put a quota on the maximum number of responses, in order to manage a course booking system.

    After 20 bookings, the form has to change to display a message saying something like "Sorry, the maximum number of participants for this event has been reached" and block the form submit.

    Any idea how to do it?

    Thank you for your reply.

  • Sven Geusens 169 posts 881 karma points c-trib
    May 30, 2017 @ 15:30
    Sven Geusens
    0

    I don't think its simple, but it might be doable

    If you look into the App_Plugins folder, there should be an UmbracoForms folder with all the code.

    The first interesting bit is the /backoffoce/dashboards/controllers/yourforms. It contains a bit of js code that loops over the form data retrieved from somewhere else and prepares the data to give those counts in the backoffice

    Second bit is in js/umbraco.forms.js there is a function in there called formResource that has a method GetOverView which is used by the first bit.

    Normally you render a form on a specific node. I usually select the form I want to show with a form picker. This formpicker contains a guid

    So...

    In your razor template you should be able to do an http call to the umbraco forms api to get the overview of all your forms. Then filter out the form data (including its entry count) by the guid of your picker. And finally not run the Macroscript but show a message if the count is higher than x.

Please Sign in or register to post replies

Write your reply to:

Draft