Copied to clipboard

Flag this post as spam?

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


  • Fredrik Esseen 610 posts 906 karma points
    Feb 01, 2018 @ 14:33
    Fredrik Esseen
    0

    Limited amount of registrations

    One of my customer who is using Umbraco Forms to register bookings to travels has an enquiery of development.

    On some travels they have a limited amount of rooms, ie, single room double room and so on. Now they want to be able to count down the available rooms when a user registrate so that there are less room available. I can easily create this functionality on a custom form but we have integrated Umbraco forms heavily in the solution and want to continue to do that in this project too.

    Does someone else encountered this and have workable solution?

  • Matthew Wise 271 posts 1373 karma points MVP 5x c-trib
    Feb 01, 2018 @ 16:03
    Matthew Wise
    0

    Hi Fredrik,

    The only way I can think of doing this would be a custom workflow, or a special "thank you" page.

    I would probably say the page way is safer so you can show the end user if they were to slow in filling out the form if it's down to the last spot.

    On submit, the "thank you" page has TempData stored so you can get the form information from that.

    https://our.umbraco.org/documentation/Add-ons/UmbracoForms/Developer/Working-With-Data/

    Hope this helps

    Matt

  • Nik 1614 posts 7260 karma points MVP 7x c-trib
    Feb 01, 2018 @ 17:31
    Nik
    0

    Hey Fredrik,

    I think you'd need to approach this from multiple angles.

    1) On the page where you render your form it would be worth checking if there is availability at that point in time, if there is render the form, if there isn't hide it.

    2) You could create a custom form question type to override one of the normal questions, such as number of rooms, for example. Then as part of the validation of this question you could check the room availability. If there is insufficient rooms available you can simply invalidate the entry and show the appropriate message.

    These two steps should combine to create a reasonably robust validation approach.

    Nik

  • Fredrik Esseen 610 posts 906 karma points
    Feb 02, 2018 @ 08:26
    Fredrik Esseen
    0

    Thank you for your great input!

    If Im going to use your solution Nik, how can I check if there are enough rooms available?

    I suppose I need to check all entries in the db like this on the page: (thank you Matthew)

    DynamicRecordList GetRecordsFromForm(string formId)
    

    and then iterate all recordfields:

    Dictionary<Guid, RecordField> RecordFields
    

    and look for my record and if its true then check my static number of available rooms.

    I think a combination of your two answers seems like a good approach!

Please Sign in or register to post replies

Write your reply to:

Draft