Form config validation

This branch starts from https://github.com/dimagi/core-hq/pull/485, so merge that in first to get nicer diffs.