Help with a custom field widget
Looks like you're just missing the column name for the field (tid).

Just before the return of the widget form function, try changing

$element +=  $widget;


to

$element['tid'] = $widget;