Explore the community Forums Lectora Lectora Questions & Answers Prevent duplicate droplist choice Reply To: Prevent duplicate droplist choice

#380006 Score: 0
Profile photo of Jason Dalrymple
Jason Dalrymple
Member
beginner
intermediate
profile
wise owl
curious george
contributor
friend finder
advanced
picture perfect
54 pts
@JasonADal

So, I made some really significant progress on this and am attaching the result, which is likely to go into the Shared Content section. There is ONE piece I’m still working on, which is the ability to highlight the two duplicated answers instead of just the one that’s been selected.

I was able to get the function to run twice. However, it did not highlight the two duplicates and gave the alert twice (I expected the latter to happen). Any ideas on how I can add the border to the duplicates and only have the alert once?

As to the rest, I’m attaching my results and will likely get it up to the Shared Content. In a nutshell, I combined the jquery to check for duplicates and the JavaScript to check for and highlight blanks. The JavaScript also sets a variable used in another action to generate an alert or continue processing the submit actions. Basically, I set it up so that the loop in the JavaScript adds or subtracts based on whether or not the drop list value is blank.

The sample includes explanations and the originals from @timk for how to use it on regular drop lists and multiple choice questions that use a drop list and all have the same set of possible answers.