Sort Task form by Tag Group

Sorts the tag list on the task form by tag group. For implementation reasons, we can't add separate groups here like on the tasklist,
but this is the next best thing.

Also fixes a bug with the tag widget introduced in the previous commit.