Create a simple booking page


Any association or institution organizing an activity wants a registration form. Usually there is a limited number of participants.

How do you create a form that tracks how many people have already been registered and how you make it impossible to book once the maximum number of participants has been reached? There are modules for that, but they are quite heavy and complex.


1) Create a content type with the options. For example ... We have a training up to five people. People can choose between two dates, but each time we have only five places. You see I repeat the node a certain number of times per date. You could also provide here a numbered place. If many nodes need to be created, I refer to Feeds and a CSV file to do this. In now take node reference, but taxonomy reference is also possible.


2) Create a content type 'Booking' with a reference field to your content type with the options. Put multiple if necessary. For example, one person books for several people in his / her name.


Now one can book.


I have booked in my name for three people on 27/10


3) How do you create that the next person is unable to use already taken places? A new booking should only see this. Three places have already been taken.


We therefore make a view, where we show the places and the bookings for these places.


There is a relationship necessary to do so as we combine two content types.


Set the 2 fields


The Title field is X 2. The second time, however, with the relationship:


You get this.


However, since we want only the free places we now have to filter.


You will see that there are some places are missing. Where there is already booked for ...


4) Set a reference entity to use your reference field.

Copy your view to entity reference.


Customize your field in the widget to your reference. 

From now on your booking page is operative. Now only grant access rights to the form. If all the places are occupied you only get the description of the field.