So, element that triggered AJAX gets disabled. But how to make Drupal also disable everything inside ['#ajax']['wrapper']
? After all, allowing user to edit something that will get replaced as soon as AJAX response is ready isn't the wisest idea, and I'd like to prevent that. And my AJAX created elements have their own AJAX too, race conditions are pretty bad already.
Is there any ready-made module for that? Or API way I'm missing? If no, where exactly should I put that code to minimize risk of incompatibilities?
Edit: I'm looking for a safe and stable way. It means no hard-coded identifiers in JavaScript files. Solution that breaks when someone edits form definition, or one that works for only one AJAX in form is not enough. After all, I need to avoid race conditions, and I already noted I have multiple AJAX actions, working on different sets of elements, on one page - so no marking elements for disabling at PHP level. I can eventually mark them with classes like disable-on-X
and disable-on-Y
, but I need to know if it's X or Y AJAX happening. And ideally I'd just disable everything inside ['#ajax']['wrapper']
without any additional marks, as they are not really needed - but again, I would need to know proper ['#ajax']['wrapper']
in javascript.