Streaming live at 10am (PST)

(SOLVED) Dynamic Checkbox ID

#21

Hi all,

Just a quick note to let you and others know I found a way to dynamicaly change my checkboxes ids and names with the help of @sabanna ! I didn’t have to use JQuery, just define the html structure of the checkbox inside the embed code, then inject the dynamic field to pull the ids from the multi-reference field of my collection list. Works like a charm !

<div class="custom-checkbox">
	<input type="checkbox" id="dynamic-field" name="dynamic-field">
	<label for="dynamic-field"></label>
</div>

I hope this post might help others too :kissing_heart:
Also I pimped the checkboxes with a bit of code I inspired myself from a stackoverflow’s post.

2 Likes

#22

Hey @anthonysalamin i’m happy you managed to do it with super @sabanna :slight_smile:
Would be so nice to share it on tips and tricks for example and explain the whole process of doing clean CMS Checkbox :stuck_out_tongue:

0 Likes

#23

Hi, thanks for working this out and sharing, but I am confused as to the purpose of what you have achieved here? Please explain. Thanks

0 Likes

#24

Hi @zbrah,

Cool yes I could write a little post on clean CMS checkboxes for the tips and tricks ! It’s a really simple trick actually but super useful in my case as it will empower the owner of the future theater website, to better manage the reservation system of the events happening along the year. I could make a post when the website is finished !

@RoseWebStudio, to sum up the idea : The theater organises around 30 events per year. Each event have around 10 different date at which the event takes place. In the event collection list, I had to multi-reference those date for each event as they are different every time.

The checkboxes in the form, are actually there to allow the person who wants to see the event to pick one or more available date, then write his name, email adress and finally book his reservation. I had to use dynamic checkbox’s ID so that in the email the owner of the theater receive after someone has booked a reservation, which option (date + hour of the event) the customer decided to choose.

Without the dynamic field that dynamically rename (from the multi-reference field) the checkboxes, the owner would only receive in his email confirmation : Field1=true, Field2=false, Field… :wink: Like I said the technique is no big deal but now the owner can surely better organize himself, seeing the proper date names instead of the generic checkboxe’s names.

3 Likes