So, I'm trying to filter a select list by one of the other fields on a node. In this case, we will select a taxonomy term (you can only choose one) and then based on that rerender the select list of an EntityReference field. I'm aware of how to do this with something like hijacking the #autocomplete method on a form element, but for this use case we need to keep it as a select list.

Currently, I have the view setup and ready to accept an argument by which to filter. I'm not sure how to dynamically pass the argument to the view though. In my code I have this so far, in a hook_form_alter:

$form_state['field']['field_current_unit']['und']['field']['settings']['handler_settings']['view']['args'][0] = 6;

This is not changing the argument on load like I had hoped. Beyond that, none of the rebuild options appear to be working for me. I can only manually set this in the field settings. Any thoughts? Sorry if this is too vague.

Your Answer

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

Browse other questions tagged or ask your own question.