humbabba Posted August 18, 2016 Report Share Posted August 18, 2016 Hi, I'm designing a poll app. It's a simple one-question poll with an arbitrary number of answer options. I have a connection on it to authenticate users and require them to log in before answering polls. Everything is working so that my admins can make new polls/answers and users can log in and answer them. However, I can't figure out how to restrict users to one answer per poll. I have tables for users, polls, answer options for each poll, user responses. It's all working, but I need a (non-kluge) way to check whether a user has already responded to the specific poll before inserting a new response in the response table. I am stuck. I have a kluge in place (basically tracking in an array which polls the user has responded to in his record in the user table). I'd love it if Caspio Bridge would let me do a "single-record update" or "details page update" which would, if it couldn't find the record, insert a new one. Something like that would make this app perfect and kluge-free. Or maybe I need to go about it another way entirely? Any feedback appreciated! Quote Link to comment Share on other sites More sharing options...
MayMusic Posted August 18, 2016 Report Share Posted August 18, 2016 As I understand each user can answer to only one answer per poll, meaning the combination of User ID and Poll ID should be unique. So you need to add one more field to the answer table and make it unique. In the submission page where user can answer include this field and use the script at to combine IDs and save it in that field upon submission. Quote Link to comment Share on other sites More sharing options...
humbabba Posted August 19, 2016 Author Report Share Posted August 19, 2016 Thanks MayMusic -- I thought of that, but then figured I'll get an error for users who've already answered, won't I? Problem is, when people visit the page with the poll on it, what displays depends on whether they've already answered. So I need a way to check for such a unique value and behave differently depending on whether it's already there. Can't try to insert or I error out if unique value is already present. Right? Quote Link to comment Share on other sites More sharing options...
MayMusic Posted October 14, 2016 Report Share Posted October 14, 2016 What if you first have a search page so they can search and if no records found then show a link to answer. You can create the link to submission page in the localization you specifically using for this report page as custom text <a href="Submission URL"> Answer </a> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.