Thank you for your input. I tried this last night but it didn’t work
I tried to conditionally register a repeater field that should sit within a tab field… but I threw out some errors.
I think I stick to your class solution. Thanks a lot!
Thanks a lot. This works. But I’m a bit concerned that the field is still part of the form (just hidden)… for security reasons I’d rather see a possibility to use the load field filter in a way to remove the field. But this seems not to be possible.
I want to show / hide the field in the frontend form based on a custom user meta.
So no conditional relationship to any other fields. I want to have some sort of php condition whether to show the field for the specific user at all in the frontend form (where users can send in posts).
Something like this (pseudo code)
if(get_user_meta('myfield') == 'myvalue'):
show_this_acf_repeater_field;
endif;
If anyone is able to help, this would be highly appreciated. Thank you.
Okay, I figured it out. The JS actions ACF offers were the solution. So if someone else stumbles across the same problem, please have a look at http://www.advancedcustomfields.com/resources/adding-custom-javascript-fields/
If you want to initialize a new select2 for example use following JS
acf.add_action('append', function( $el ){
//$el is the appended element, in this case a row
$el.find('select').select2();
}
Thanks for this great plugin.
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.