Fixes #7750 - hidden required fields do not prevent submit

When a field is explicitly required an HTML5 tag required was added
which caused issues during form submit.