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.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.