Reviving a request here by @Anna_Kelian, I’d like to be able to use dynamic content in form attributes.
I have a dynamic list of form checkboxes that I would like to associate with their form labels – as they are in a dynamic list, if I apply a name attribute to one of them it applies to all – hence I’d like to be able to use dynamic data to define the ‘name’ attribute so it can be clicked to activate a checkbox.
For anybody interested, I achieved this by using some Jquery. In my use-case, I needed this to build a dynamic category filter interface for dynamic lists using the great tutorial from @sabanna (hence the ‘var filter’ names in the code).
Add a dynamic text block with the text you want as the attribute and give it a class.
Add the code below as custom code, and edit the class in the first line of the the code below with the class from step 1.
Change ‘for’ in the last line with whatever attribute you want to change (eg. ‘for’, ‘value’, ID etc).
Please note, I’m no JQuery expert, this worked for me but feel free to suggest a better way if anybody knows!
var filter = $(‘.course-filter-label’);
filter.each( function() {
var label = $(this);
var txt = label.text().toLowerCase();
label.attr(‘for’, txt);
});
@matt50 thx for reviving this request. It will be super helpful to one of my clients who has a cash-on-delivery store and whats to move to Webflow. The ability to link dynamic content to form values will make ordering both individual and multiple items (using checkboxes) super easy.