I was wondering if anyone else has ran into this issue and/or has any ideas.
Basically, I would like to use field collection in order to create a group of fields that would include a user reference and some associated options. (As an example.) It would not make much since for the same user to be chosen multiple times. (Which would be possible with the current setup, if not mistaken.)
What I am looking to do is limit the user reference so that each group is forced to be associated with an unique user. I know of the Option Trim module. However, it is not yet available for D7.... Plus, from what I can determine, I am not sure it would be compatible with Field Collection even if it was ported.
So, I was just curious if anyone had any suggestions on how to accomplish this... I realize that I could probably create some custom code that would check for duplicates on the field submission. However, a solution more along the lines of the Option Trim module where the actual selections are limited using jquery.... seems more elegant and user friendly. Unfortunately, I am not very well versed in jquery and was curious if anyone else had tried something similar.
Or perhaps, even if anyone else would be interested in a similar feature in this module???
Comments
Comment #1
jmuzz commentedYou don't need to use jQuery. The best way is probably to implement hook_form_alter to remove the values the user shouldn't be able to select. This will change the form before it is presented so it should do what you had in mind.
Option Trim seems like it would be the alternative to using the hook. The idea to remove duplicates from a reference field really isn't specific to field collections.