yes I understand the problem now. I imagine it's a problem of the scope in which you call your proc. My guess is that you are returning the generated HTML in your proc somehow, instead of allowing the form builder to do it for you.
There are plenty of examples already in OpenACS of calling template::element create from a proc. If you're using Project Open, take a look at DynFields; I know it's done there.