Support

Account

Home Forums Backend Issues (wp-admin) Fill fields after change value in another field Reply To: Fill fields after change value in another field

  • This can be done by :

    – 1st : pusching the selected data to the ajax request. For this you should use
    select2_ajax_data javascript filter and add a new element in the ajaxData array using the ACF JS API.
    Let say ajaxData.myparameter = getField(yourselectbox)

    – 2nd : Once this is ok, use the acf/field/post_object/query on php side.
    This filter is used to retrieve information and add them to the query.

    For this get $_POST[myparameter] ?? get_field(yourselectbox).

    $_POST : used to get ajax value from JS.
    get_field() : used when you update the page to used the current saved value for yourselectbox.

    Then you update the query to get the value for the other fields.