Same issue here. Need to ajaxify address field the zipcode field, tried after_build, #ajax, #process callbacks, didnt worked. But if we give #ajax callback to main address field it works but still only the ajax progress bar comes in that scenario.
- Status changed to Closed: works as designed
8 months ago 10:22am 3 November 2023 - πΊπ¦Ukraine sickness29
Tried address 1.x with webforms 6.2 and was able to reproduce the issue, however I don't think that's issue.
During hook_webform_alter or hook_webform_element_alter (from 6.2 version) there are no inner elements for address field, only main #type address field which only serves as wrapper for address textfields and selects, so attaching ajax here won't do anything.
After built also was not successful and I could not figure out why, perhaps because address element itself uses ajax and attaches it in process function.
Best way to add ajax there is to add hook_element_info_alter and add custom #process to address element, there in process callback it's possible to add ajax to country_code, postal_code and all inner elements, but please beware of existing ajax on country_code. If it is necessary to add something there you can change ajax callback and do what is needed and return Drupal\address\Element\Address::ajaxRefresh() or return array of ajax commands.
Anyway, I don't see any point in changing module code since there's a way to add ajax there as I described above. If there is still something we can do about elements in module to make ajax work better, please reopen with suggestions. - Status changed to RTBC
8 months ago 10:51am 3 November 2023 - πΊπ¦Ukraine sickness29
Hi TMWagner, please check if solution from comment above works for you.
Hi maintainers, please close/fix the issue if you agree on the comment above and we don't need to apply ajax from address element to any inner
- Status changed to Fixed
7 months ago 10:56pm 30 November 2023 - π·πΈSerbia bojanz
Don't see what else we can do for now, so closing this. Thanks, sickness29.
Automatically closed - issue fixed for 2 weeks with no activity.