Fix some bugs in FormSubmitter.
Add tests for FormSubmitter.