Auto generate unique ID for field AND validate that the ID isn't being used already

Yoyo Bubble asked on May 21, 2019 20:03

Good Afternoon fellow Kenticans,

We've gotten a request from our analytics team to add a field to all widgets that contain clickable items (links, buttons, etc) so that they can add unique IDs to those elements. I.E. we have a cards widget that has a button - There will be a field to type a custom ID for that button. Simple enough.

Things get complicated fast on the second part of the request.

They'd like to 1.) be able to autogenerate a unique ID in the field and 2.) If the ID is edited by the user (let's say they want it to be #cta-button-2 or something), have it validate whether or not this ID is being used already.

This seems like it will require some heavy customization on the backend of kentico which I'm not too familiar with but I guess I'd just like to at least know if this could be possible. And if it is possible, could anyone point me in the right direction for implementation?

Any assistance is appreciated! Thanks in advance!

Correct Answer

Brenden Kehren answered on May 21, 2019 20:09

Instead of having the system validate it, leave it on the content editor/owner. If the content editor/owner is technical enough to be entering ID's, they should have an idea on how to look for duplicates when they add the widgets to the page. Secondly, you could add a prefix to the widget and prefix the ID with this to help it be more unique and possibly create a "grouping" of controls with that prefix.

0 votesVote for this answer Unmark Correct answer

Recent Answers

Yoyo Bubble answered on May 21, 2019 22:34

Thanks for the quick response, Brenden. I couldn't agree with you more on the first part - Was planning on having them do that anyway. Our CE's are pretty lazy over here so they always try to get even the simplest tasks to be automated.

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.