Home › Forums › Backend Issues (wp-admin) › Get the saved value from a dynamically loaded Select field using JavaScript API › Reply To: Get the saved value from a dynamically loaded Select field using JavaScript API
The field definition really won’t help me.
When you make the AJAX request you need to send the current post ID as well as any other data you’ll need to get the current value to be returned.
Another alternative is to also use an acf/prepare_field filter to also set the choices in PHP. If you do this then ACF will set the selected value. You can then get the selected value before updating the choices using JS and then reset the selected value after.
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!
Make sure to register for tomorrow’s special ACF-focused edition of #BuildModeLive. Iain Poulson joins @hellosammunoz & @bgardner for a discussion about ACF’s roadmap and what’s in development. https://t.co/k93h4pYCae
— Advanced Custom Fields (@wp_acf) January 26, 2023
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.