Forum OpenACS Development: Re: Ad_form DOM error
The new OpenACS versions (5.3.*) have many quality improvements for the generated HTML, mostly from the Zen project. The labels and input fields are linked via IDs (most likely addressing your PS).
The code snippet that you included does not intend to provide an HTML ID, but is used for the form handling internally in OpenACS. It is certainly possible to change from FORM names to IDs and use current name as HTML ID (not all names are valid IDs, most likely no big issue), but this is more of a feature request than a bug fix.
Is seems to me that DOM is more like a model from wich you can access some document pieces, it doesn't matter the platform you use. The problem in ad_form is when you try to use somebody else JavaSript libraries, wich is what we do in Ajax Helper. The prototype framework has a lot of functions wich use the document.GetElementById method to access some content from the page, such as the Form.Serialize(). As our API doesn't generate the form id it's impossible to get the form with this method and the function doesn't work. There are some other functions that break on that too.
Yes, there's a very simple workaround using the -html switch in the form generation, but I don't think it's the best way. We allways try to be inside the W3C recomendation all the time, and in that specific case it seems to me that we are not. Almost all the forms in the Internet have the id set, wich also seems to me a W3C recomendation, so I think we should do it too.
I don't know if I'm putting this in the right place or in the right way, but I guess this is something we should think about. Something like an improvement to be made.
In general, the HTML syntax specification for IDs and names is the same, the only potential conflict happens when the HTML document has already an ID for a different element, which is identical to the FORM ID. For the existing apps i have checked, this does not appear to be a problem. In general, we should define in openacs naming convention for all IDs and names to avoid clashes. This is however a larger issue since it involves CSS as well, when we start to rename IDs, on which some applications might rely. So, keep this in mind, when you use the FORM IDs (or other IDs).
If you need any help in this kind of work, let me know what I can do to help. I don't have commit rights but maybe I can submit a patch for these boring fixes.
Thank you for the good work.