Dynamic dates and button url

Hi, community!

Need your help because I have a big challenge to face with.

So I have a website where users can select some training and buy a ticket via a 3rd part service.

Users can select the language of the training so different dates and currency will appear and it was done by me. The biggest challenges now are:

  1. To make these dates not static but dynamic. I have a CMS collection with the training details such as description, price, duration, etc. but there are no dates there. What is the best way to populate dates here? There are 10 training and each training can have one or two dates for every language. I was thinking about a separate collection with dates but can’t figure out what structure this collection needs to have and how it might work…
  2. “Enroll” button URL needs to be changed depending on what date was selected. This is also a funny part because I’m not sure how to make it work this way :slight_smile:

I will be appreciated some help here!


Hi @Sergii , Welcome to the forum :smiley:

This is a great question!
I would go with you initial thought and create a separate collection for dates. Then I’d add a multi-reference field in the main training collection. This was you’ll be able to add and remove multiple dates to and from each item.

Regarding the Enroll button, what needs to be changed once a date is selected?

Hi @avivtech!

Thank you for a such quick response and the answer. :slight_smile: I was thinking of the same solution but in this case If, for instance, training has 2 dates in Polish and 2 dates in English, I need to create 4 entities for the same training in a dates collection, right?

About the enroll button, it’s a link element, so when a specific date is selected - the link URL needs to be changed to one that is associated with the date.

1 Like

Yes, if you have 4 options you need to present 4 options.
You can add a field in the dates collection to specify language, and then I would tackle this with a bit of JavaScript- show / hide only the relevant dates.

This also would be best done with a bit of JS, to change the button href attribute according to selection.

1 Like

Thank you @avivtech! First was done - dates are displaying correctly according to languages. :hugs:

About the button href attribute, I need to store a different URL for each training date, so probably I can add a field “URL” in the dates collection? I don’t understand how can I take that URL and put it to the href attribute :confused: I understood that I need to use JS for that but never done that before in a WF :smiley: Can you give me some advice in more details, please?