Added support for opt-groups within the selectfield factory method. Also added optgroup factory method. Added unit tests.