Only submit dialogs if form is valid

Support browser validity checks for input[required] and input[pattern] and the like.
Merge pull request #1 from elisee/check-form-validity

Only close a submitted dialog if the form validates