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?
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.
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?
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
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
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)
and then iterate all 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!
is working on a reply...