PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Exclude already selected items from dropdown choices

  1. I couldn't find an answer to this anywhere I searched.

    Is there an easy way to exclude items that have already been selected from a dropdown list of No Duplicates is selected. As it is now I can prevent duplicates from being selected but I'd prefer to exclude them or hide them from the list so the user cannot even select them.

    If there isn't and easy way I can build custom functionality (if possible) but I could use some pointers as to how to get the values from the entries database and which part of the documentation to look at.

    Thanks!

    Posted 12 years ago on Tuesday October 4, 2011 | Permalink
  2. Currently No Duplicates doesn't work this way with drop downs, radio buttons and checkboxes. BUT it is a feature we do plan on adding. Right now it just prevents you from using an already used item, it doesn't currently hide it.

    If you wanted to hide it you would have to write custom functionality to query entry data and then hide the options that should not be displayed. I'm not aware of any examples that show how to do this. You would have to use the gform_pre_render hook which is documented here:

    http://www.gravityhelp.com/documentation/page/Gform_pre_render

    Posted 12 years ago on Tuesday October 4, 2011 | Permalink
  3. I think I've got most of it worked out. i'll have the base data in an array and then get the entry data into an array and do an array diff to return the remaining values. I'll post an example once i get it working. Thanks.

    Posted 12 years ago on Tuesday October 4, 2011 | Permalink
  4. I've got an additional question. I can't seem to find clear documentation on how to pull the entries for a particular field so that I can compare to the original list values. I've looked at the Entry Object documentation but it's a bit sparse. Is there anywhere that this is documented? Basically I just want to return or create and array of values that have already been chosen from the list of choices in a dropdown so that I can filter the already selected values from being populated into the list of choices.

    Posted 12 years ago on Thursday October 6, 2011 | Permalink
  5. There isn't any documentation for displaying entries because it isn't built in functionality. To query entry data you would need to query the Gravity Forms database tables directly.

    Posted 12 years ago on Thursday October 6, 2011 | Permalink
  6. Fair enough. Thanks for the answer.

    Posted 12 years ago on Friday October 7, 2011 | Permalink

This topic has been resolved and has been closed to new replies.