Hi Gustaf
I got a chance to play with your code and it works quite well. A few comments/questions.
I had to add the following to deal with XHTML tags e.g. <input... /> as there was an additional forwardslash key in the attrs dict.
set attrs [dict remove $attrs / ]
The code does modify the original HTML slightly but I don't think this is an isue e.g. 'checked' gets changed to 'checked="checked"'. I haven't tested more complex input fields e.g. ones with onclick or file uploads etc. Ideally it would be great to leave these as-is, but I'm not sure if this is possible?
Another question I have: do you know of any way from within the tag-input proc to pass messages to/from the containing form? My goal here is to remove all hidden input fields from the form, and replace them with a single hidden field whose value will be stored in the session, and which gets submitted in the form.
best wishes
Brian