I would also recommend to be very careful when building dynamically your form.
Some attributes are mandatory and the checking is done directly by fglform - your aui tree may be correct from a DTD perspective, but not from the application point of view ; so you may encounter very strange results as the front ends expect some attributes to be defined the way fglform does.
GDC also expects to have some attributes at creation time, so if you make something like
myLabel.setAttribute("posX","2")
CALL ui.interface.refresh()
myLabel.setAttribute("posY","5")
posY = 5 will be ignored, as the widget will be created once ui.interface.refresh() is called, at this time posY equals 0, and GDC does not manage further changes of posY attribute.
So please make sure your form is created the same way fglform would create it.