Skip to main content
edited body; edited title
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

D8 - How todo I modify a core field to use ajaxAjax and add markup?

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 ajaxAjax 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?

D8 - How to modify core field to use ajax and add markup

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?

How do I modify a core field to use Ajax and add markup?

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?

[Edit removed during grace period]; edited tags
Link
Source Link

D8 - How to modify core field to use ajax and add markup

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?