Each form has the following structure:
<form>
<div>
form elements
</div>
</form>
If I want to use ajax for the whole form I cannot use form's #prefix and #suffix for the wrapping div because It'll wrap the whole form and the ajax will brake. In order to replace the whole form with ajax I have to create two form elements(opening div with ajax wrapper id and closing div) and give them the lowest and highest weight so they'll "wrap" the rest of the form.
As I've mentioned above, right now the form wraps all elements in a div which has no attributes. I propose that the forms should utilize this div and add the form's id as the div's id attribute with '-wrapper' as suffix. This way we won't have to define the unnecessary form elements anymore(or override the form's theme fuction). Though there may be an issue with duplicate form IDs but that should be handled by hook_forms(D7) or by generating custom IDs manually(d8).
Comments