AdvancedCustomFields / acf

Advanced Custom Fields
http://advancedcustomfields.com/
835 stars 170 forks source link

ACF select2 : can't emulate a click on an option in Javascript #145

Open lePouns opened 5 years ago

lePouns commented 5 years ago

Hi everyone

I use acf_form() to let people editing post_type on my webiste. Works like a charm except for one thing, my first field is a selection type with advanced interface aka select2

I have one special case, when a certain user role arrives on the my acf_form(), he can't select what he wants, only 1 option is possible, and it leads to show some fields thanks to ACF's logical.

Problem is, i can't figure out how to emulate the selection of this field with javascript. Tried so many things my head begins to burn ^^

Thanks in advance for your response and sorry if im not clear .. ++ Gilles

elliotcondon commented 5 years ago

Hi @lePouns

Thanks for the question. Can you please elaborate more on the issue.

What do you mean by "he can't select what he wants"? Perhaps putting together a screen recording would be a good way to explain the issue.

If the "Select2" element is not initializing, please be sure to check your console log for JS errors. If the choices dropdown does not load all the choices correctly, please review the AJAX call to confirm the args/response are correct.