Home › Forums › ACF PRO › insert values into fields programmatically › Reply To: insert values into fields programmatically
You can target specific fields by using something like this
$('.acf-field[data-key="field_0123456"] input[type="email"]')
field_0123456 represents your field key.
As far as getting the value from the field, every field is going to be a little different. For example, a WYSIWYG field is a standard WP tinyMCE field and you’re going to need to look into how to get the value from that field. Other ACF fields will need to be look at on a one by one basis, but you can target specific fields with actions and to get values using the same basic method that I gave above by using the field keys. Updating other fields in the form is going to be the same as getting values from fields, each one is going to require different code depending on what type of field it is.
I have some examples of getting values from some types of fields and updating values is some types of fields, but I don’t have them all figured out. You can see my examples here https://github.com/Hube2/acf-dynamic-ajax-select-example.
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.