I created a field “client” with the wp users.
In my admin page i’d need to listen to on change on this drop down.
This is what i tried but no effect…
…my second question would be:
I get the WP users in your Dropdown field by login, how could i retrieve user ID onchange in the list ?
ok it works with this below, could you please now have a look at my second question please ? thanks
oh yes !!! magical ! this.value gives me directly the user ID, !!
when select on change , how could i set my other act fields with new values please ?
In fact , more generally this is my case :
I created a custom post type and added the ACF fields in the admin post page.
My first ACF fiels is a WP User Dropdown, and when loading page or changing value in drop down list i need to update all fiels that depends on $user_id
The walkthrough to follow.
– get the user ID (there are functions to do that)
– add it to the ACF ajax query.
For the other fields depending on user ID value :
On PHP you should use query filters (there are some for taxs, posts, relations)
– get the $_POST[ID] (added by JS before)
– use it.
When you load the page (ie for an update) , $_POST[ID] does not exist but you can use get_field if you need to use your query filters with user ID
RogerBSulli, I think the best is to open first a new thread.
Regarding your problem, it coulb be easily solved with few JS code.
The topic ‘OnChange Select DropDown’ is closed to new replies.
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!
10 years ago, a little plugin called Advanced Custom Fields popped onto the https://t.co/79Y5uWU7lY repository hoping to help a few like-minded developers.— Advanced Custom Fields (@wp_acf) May 31, 2021
Those “few” grew to 2M 📈🎉
Join us in celebrating 10 brilliant years with 10 tweets of brilliant features found in ACF! pic.twitter.com/oT1HPjdygF
© 2021 Advanced Custom Fields. Subscribe