New issue
Advanced search Search tips

Issue 596138 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner:
Closed: Mar 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 2
Type: Bug



Sign in to add a comment

Required attribute is still enforced for radio buttons after removing via JavaScript

Reported by dylanmcc...@gmail.com, Mar 18 2016

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36

Example URL:

Steps to reproduce the problem:
1. Load a page with an HTML form that includes radio buttons with the "required" attribute, and client-side validation enabled.
2. Remove the "required" attribute for each radio button by manipulating the DOM, either with the developer tools or with JavaScript on the page itself.
3. Attempt to submit the form without setting a value for the radio buttons.

What is the expected behavior?
The form should happily submit, because the radio buttons are no longer required. This is consistent with how other input elements behave.

What went wrong?
Instead, the form does not submit. Chrome requires that I select an option for the radio inputs.

Does it occur on multiple sites: Yes

Is it a problem with a plugin? No 

Did this work before? Yes I am unsure which version, but it would have been around three months ago

Does this work in other browsers? N/A 

Chrome version: 49.0.2623.87  Channel: stable
OS Version: Fedora 23
Flash Version: Shockwave Flash 21.0 r0

I am attaching a minimal test case which should reproduce the problem. Note that Firefox 45.0 exhibits the correct behaviour. My example form has two radio inputs and a text input which are all initially marked as required, but the "required" attribute is removed immediately after the page loads. Note that the validator only complains about the radio inputs - not the text input.

This problem does not appear to happen in reverse, when I add the required attribute on page load.
 
form-error.html
1.4 KB View Download
For my own purposes, this bug was an issue because I had a form with elements that were sometimes required and sometimes not (depending on whether they were filled out), and Django + Floppyforms generates unhelpful markup for the case. I worked around this issue by hacking some template files, and that's fine, because they shouldn't have been required initially anyway. (Folks with JavaScript disabled and all that).

Still, this could definitely cause problems with *existing* web forms, making them difficult to submit.
Components: -Blink Blink>Forms
Labels: Te-NeedsFurtherTriage

Comment 4 by tkent@chromium.org, Mar 23 2016

Components: -Blink>Forms Blink>Forms>Validation Blink>Forms>Radio
Owner: tkent@chromium.org
Status: WontFix (was: Unconfirmed)
Reproduced with 49.0.2623.87 stable, and not reproduced with 51.0.2687.0 canary.  I assume this was already fixed.

Cool beans. Thanks for checking :) I'll keep an eye on this and leave a note if it appears again.

Sign in to add a comment