Unique Combonation of field values?
This is an open discussion with 1 reply, filed under General.
Search
Maybe you could add the Unique Input functionality into the Reflection field? Use the reflection field to concatenate the values together then run it through a uniquity check?
Create an account or sign in to comment.
Today I somewhat hacked together a solution for a problem, and now I’m wondering if there is already an extension that does this, or if maybe I should flesh it out to share. Here it is:
Today I needed a section that would only allow a unique combination of field values within a single entry. Specifically, I am recording votes for multiple entries (It’s a ‘Did this entry work for you?’ type of voting scheme). The goal is to allow uniquely identitifed users to vote only once per entry.
So I have a Votes section that records the entry id that is voted for, and a unique user id. I had somewhat absent-mindedly just used a unique input field for the user-id, but that didn’t work, because it locked that user out of voting for any more entries, not just preventing them from repeatedly voting for a single entry.
My solution was to modify the unique text field to check for the pre-existing combination of fields (userid + voted entry id) rather than just userid. (Using the awesome SymQL for my own sanity). Does this functionality exist elsewhere?