Hi, I need to create a select menu where user chooses a CAR BRAND and in the other select menu the MODEL CAR.
But I need that when user selects one CAR BRAND the MODEL CAR SELECT only chows the models for thar brand.
Is this possible?
I have found this https://github.com/Hube2/acf-dynamic-ajax-select-example but it’s to old and it doesnt work
Thanks,
Francisco
Yes it works – it works with a little bit knowledge using the perfect example from Hube – but it works also with standard ACF functions. You should use a standard select field with UI and AJAX activated. Your PHP action load_field should be set for this field and load the correct data. This is for both fields. Your second field should “hear” on $_POST[‘your_var_brand’] and then you should do a little bit work on your JS file…..
Have a look at the ACF JavaScript API documentation. The keyword should be:
acf.addFilter('select2_ajax_data', function( data, args, $input, field, instance )
I have used this in my actual plugin project in 15 fields and it works great.