I am still getting the hang of D8... I have some entity types with various reference fields. I need to ajax in other values from another node type when changing the value of the entity reference select field I have.
Node type form 1:
#####################################
# _____ #
# |Title| #
# ___________ #
# |Description| #
# _______________________________ #
# |Node type 2 select reference |v| #
# #
#####################################
Whenever I select a node from the Node type 2 select reference field I would like to Ajax in a specific view mode of the node as #suffix
markup. After selecting a node the resulting form should look like this:
#####################################
# _____ #
# |Title| #
# ___________ #
# |Description| #
# _________________________ #
# |Some node (node id: 2) |v| #
# #
# * Node 2 value from field 'a' #
# * Node 2 value from field 'b' #
# #
#####################################
I have attempted using #ajax
property in a hook_form_alter
on the select field but am not getting it to work due to errors. What is the best approach here?