I have a site that has lots of checkboxes. They are in different accordions but are all part of the same form. Labeling these will be a huge effort and setting custom attributes will be even more difficult.
I have all the labels in a Google sheet under the appropriate headers.
My question is can I import the sheet or refer to it, using the applicable header and cell values for the labels and the custom attribute? The custom attribute will have a “data-ms-item” prepended to the label.
Any suggestions would be greatly appreciated. I don’t want to manually set up 100+ checkboxes.
Here is my site Read-Only: LINK
(how to share your site Read-Only link)
hi @hogana AFAIK in WF is not such a mechanism that will dynamically create attributes and permanently assign their values into FW UI elements attribute fields from Google Sheets or any other sort of source. This should be done when creating a form.
This is the only way.
Just like Stan, I’d use JS for this kind of requirement-
However I think there’s actually a way to do it without any JS if you use collection lists.
You can import it into a CMS collection, and then use collection lists inside of your form to generate and present the checkboxes.
Prepare your checkbox list so that you have a checkbox
group, and possibly a
sort field. Import that CSV into the CMS, as e.g. the
Drop collection lists into each of your accordions, bind each to your
Checkboxes collection. Use conditional filtering and sorting on each collection list to get the set of collection items you want, and then lay them out accordingly.
You can temporarily use a checkbox element for the above but you will not be able to bind your desired checkbox name for output, so in the final version you’d drop an HTML Embed with an actual checkbox into that collection item, and bind it- something like;
<input type="checkbox" name="sampleName">
<label for="sampleCheckbox">Sample Label</label>
Then you’d use +Add Field to replace
Sample Label with your Name,
You can get fancier with this approach, having different names than displayed text, setting the default check state, etc.
Using CMS hack is actually a great idea but IMHO it is more work and unnecessarily complicated hack than doing it manually, but in the end, it will depend on the dev skills level.
I really like this…, but will it be sluggish? And Stan brings up a good point, will it be the same or more effort than manually?
When it comes to anything of scale, manual is almost never the best answer.
The reason is that you’ll almost always need to change something later.
If you build a structure to make those changes, those changes are reduced from 100s to a small handful.
No performance cost at all, the collection lists are rendered server-side.