Skip to content

Loading…

Unchecked required checkboxes don't prevent form submission in IE8 / Safari #236

Closed
allspiritseve opened this Issue · 2 comments

2 participants

@allspiritseve

In IE8 and Safari (and presumably any browser that doesn't support HTML5 form validation), unchecked checkboxes with required="required" don't prevent form submission.

Looking at the code on line 236:

if (nonBlank ? input.val() : !input.val()) {

It's only checking val() on required inputs, but checkboxes return a value even if unchecked so they will never be deemed "blank".

@JangoSteve
Ruby on Rails member

I'd like to make sure if we change this, that we keep it consistent with the browsers that do support HTML5 form validation. Do you know off-hand how Opera/Chrome handles this? I.e. do they consider unchecked required checkboxes to be invalid?

@JangoSteve
Ruby on Rails member

OK, I've confirmed that both Chrome and Opera treat unchecked required checkbox inputs as invalid with their built-in HTML5 form validation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.