4

Ok. Perhaps this has been asked before in this site somewhere but for the life of me I can't find an answer.

I have three content types: Client, Contact and Job ticket.

Clients are companies with whom I conduct business. Contacts are contact persons within these companies. The Contact content type has a reference field referencing their company's node. Job tickets are tickets for jobs these companies hire me to do for them. In this content type I have two reference fields: one for the Client and one for the Contact.

What I need is to have the Contact reference field (drop down select list) dynamically populated with the contacts for the client I chose in the Client reference field (another drop down select list). Because if I populate it with ALL the Contact nodes then I get a very big list and I don't know which contact belong to Which company.

I know I can do this with a entity reference view display but I don't know how to configure it.

Thanks in advance for your help.

3

Reference field option limit

This module allows reference fields of several types to have their widgets' available options limited by the values of other fields in the current entity.

I think this link might already be enough.
If not, then I am happy to expand the answer with more specifics.

  • Awesome, that's exactly what I was looking for, thanks a lot. Although another question: is it possible to do this with views also. I'm sure there's a way to configure a view with a filter but I don't know if the field in the add node form would be populated dynamically. – Carlos Tapia Nov 7 '13 at 22:01
  • The tricky part is to get the view into the widget, and to fill it with the correct argument. That is also to refresh it when the other field changes. – donquixote Nov 7 '13 at 22:14
  • drupal.org/project/entityreference_view_widget could be interesting. – donquixote Nov 7 '13 at 22:15
0

Another option:
Entity Reference View Widget

You need some custom code and patches to make this depend on another field:

I did not try any of this, so I don't go into too much detail. Still I think this deserves to be a separate answer, to not get mixed up with the other one.

  • oops: "Maintainer's note: Time has shown that this particular implementation is not right, and needs a complete rewrite. I would not recommend using this module for now." – donquixote Nov 7 '13 at 22:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.