I have a component that uses a schema that contains a component link field with "Allow Multiple Values" checked. The components added via the component link have a drop down with states. If possible, we'd like to add a condition so that a state can not be added more than once. Is this possible?
-
So you don't want the linking component to not use linked Components with the same value? Or do the linked Component need to have unique values? If the latter, there's a "identification" option on Categories that ensures keywords aren't used more than once. The Components tagged with these keywords can't have the same name either.– Alvin Reyes ♦Sep 26, 2014 at 18:36
1 Answer
Yes it is possible by implementing an Event System. Basically you will need to implement an Event Handler for the Component Save
event for the Initialize
phase, there you can perform the validation and throw an exception if the state has been added more than once