Use an enum for web form field types

Also add a utility class for bi-directional lookup tables.