Pass value from a CCK node reference field to a view during content creation

568 views Asked by At

I have a content type EVENT which has 2 node reference fields - BRANDS and STORES. A brand can have multiple stores and are linked by node reference fields ie. the STORES Content type has a field BRANDS which is a node reference field.

When creating the event Ideally I would like the BRAND field to be an autocomplete and the STORES field to be a select list. That way when I select the BRAND the STORES list will show stores only for that BRAND. It is then easier for the user to Check the stores where the event will take place

  • The current scenario

When I create an EVENT the BRANDS field loads all the brands. The STORES field loads all the stores even of the brand is selected.

  • What I need to do

When I create an EVENT and select the BRAND, I want to load only the stores for that brand in the STORES selection.

The ideal way to do this would be to use a view to restrict the values of the STORES based on the BRAND selected. But how do we pass the selected BRAND to the view ?

It cannot be passed from the node since the node is not created yet and we cannot get the node id from the URL.

Any help with a method to achieve this using views in Drupal 7 would be great !

1

There are 1 answers

0
osman On

Seems like you need to try Conditional Fields module. So, instead of views, you can define what fields to display, what fields to hide.