The default bug view has changed. See this FAQ.

Form submission fails if a "required" input is empty and display:none

RESOLVED DUPLICATE of bug 595451

Status

()

Firefox
General
RESOLVED DUPLICATE of bug 595451
6 years ago
6 years ago

People

(Reporter: Richard Neill, Unassigned)

Tracking

6 Branch
x86_64
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

6 years ago
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0.2) Gecko/20100101 Firefox/6.0.2
Build ID: 20110909092056

Steps to reproduce:

Consider the following:

<FORM>
<div style='display:none'>
<INPUT TYPE="text" NAME="field1" required>
</div>
<INPUT TYPE="text" NAME="field2" required>
<INPUT TYPE="submit" value="clickme">
</FORM>

i.e. a form where a REQUIRED field is also invisible to the user because of display:none



Actual results:

The user  fills in field2, but cannot see field1 (and so leaves it blank). On clicking Submit, Firefox correctly warns that the input field1 must be given data, but the user can't actually see that field, and the whole thing jams up. The user cannot submit the form, either with, or without the field1.




Expected results:

Obviously this is a stupid thing for the web-designer to have done, but Firefox could perhaps do better. My suggestion is that, on identifying a form element as requiring data, firefox should re-enable the block display of the container. 

Alternatively, it could pop-up a dialog box to ask for the input value, or it could ignore the "required"-ness.
See discussion in bug 595451.
(Reporter)

Comment 2

6 years ago
Thanks for your comment; sorry for the duplicate. 

BTW, I did search quite hard for this bug before filing it, searching for any instances of "display" AND "required", but failed to find #595451. If anyone can explain to me (offline) how I should have found it, I'd be grateful for the tip; I know duplicates are a nuisance.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 595451
You need to log in before you can comment on or make changes to this bug.