Fix some bugs in the submission form.

Javascript is a special kind of hell...