• Resolved giuseppe65

    (@anguria65)


    Hi,

    I have created a taxonomy in hierarchy, e.g.:

    • Parent category “A” with child categories “A1”, “A2”, “A3”.
    • Parent category “B” with child categories “B1”, “B2”, “B3”.
      I would now like to set two fields related to this taxonomy. The first field should show only the two parent categories “A” and “B” and the second field only the child categories related to the parent category selected in the first field.
      Is it possible to do this? I have not found any examples in the documentation.

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Paul Clark

    (@pdclark)

    Showing / Hiding fields with conditional logic field options

    One option would be to create three relationship fields filtered with the where option, then use the Conditional field option to display the second and third field depending on selection in the first.

    The WHERE for the first field would be something like t.slug IN( 'a', 'b' ) for terms with slugs a or b, or t.parent != 0 for all parent terms.

    The WHERE for the second and third field would be t.parent = 123 where 123 is the ID of parent terms A or B.

    The conditional setting on the fields for children of A or B would be set to display if the first field selects the appropriate parent.

    Dynamically loading field values

    Because Pods fields save values when the save button is clicked, they is not currently a graphical method to change the values of one field based on another without a save and reload.

    Field values can be dynamically loaded and changed using JavaScript, AJAX requests, and https://docs.pods.io/code/dfv-js-api/. This approach requires advanced programming, as it requires sending requests to the server with information about selections, then updating menus as the user interacts with the page based on responses from the server.

    Thread Starter giuseppe65

    (@anguria65)

    Hi @pdclark,

    Thanks for reply.

    The where t.slug IN( 'a', 'b' ) works correctly, while t.parent != 0 does not extract any taxonomy.
    tt.parent != 0 instead correctly extracts all the secondary taxonomics.
    Am I doing something wrong?
    If I understand correctly, however, I cannot set a dynamic where in the secondary taxonomy field unless through advanced programming. Therefore, there is no way to set a where based on the content of the main taxonomy field by setting an equality with the field name (e.g. {@field_name} or {@ID}.
    Did I understand correctly?
    Thanks!

    Thread Starter giuseppe65

    (@anguria65)

    Hello @pdclark,

    I solved the extraction of the main taxonomies by tt.parent = 0 .

    Now I have to resolve the relationship between the main and secondary taxonomy.

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.