Opened 8 years ago

Closed 8 years ago

#13237 closed defect (fixed)

dijit.form.Form ignores novalidate HTML5 attribute

Reported by: roundporch Owned by: bill
Priority: high Milestone: 1.7
Component: Dijit Version: 1.6.0
Keywords: Cc:
Blocked By: Blocking:

Description

HTML 5 provides a novalidate attribute to tell the form not to validate.

The bug showed itself because I had to use required="false" to tell dojo I did not want to validate a select box (why I had to do that is another bug).

This required parameter triggers Chrome and Firefox with HTML5 validation. Adding novalidate="novalidate" to the form tag is supposed to disable this but it doesn't on a dijit Form.

Attached is full example, I tried in 1.4.0, 1.5, and 1.6 versions all behave the same. You have to use Chrome or Firefox to see it.

Attachments (1)

html5.html (806 bytes) - added by roundporch 8 years ago.

Download all attachments as: .zip

Change History (6)

Changed 8 years ago by roundporch

Attachment: html5.html added

comment:1 Changed 8 years ago by bill

I didn't try, but probably already fixed in 1.7 by [23988].

comment:2 Changed 8 years ago by Douglas Hays

bill, should I need to add these to Form.js ?

novalidate: "",
_setNovalidateAttr: "",

comment:3 Changed 8 years ago by bill

I thought it would work without doing that.

comment:4 Changed 8 years ago by bill

Component: Dijit - FormDijit
Milestone: tbd1.7
Owner: changed from Douglas Hays to bill
Status: newassigned

OK, turns out there are a lot of attributes that aren't getting copied (since [24185]), I'll fix by copying all attributes w/out custom setters. Hopefully that won't have any side effects.

comment:5 Changed 8 years ago by bill

Resolution: fixed
Status: assignedclosed

(In [25598]) Changes about automatically copying widget attributes to the DOMNode: better detection for which widget attributes are valid DOMNode attributes, to handle:

  • attribute names with dashes (ex: accept-charset)
  • attribute names where the DOMNode JS object's corresponding attribute is mixed case (ex: noValidate)

Since it determines which widget attributes correspond to DOMNode attributes by looking at the DOMNode JS object, it doesn't handle HTML5 attributes like novalidate for browsers that don't understand those attributes.

Note that checking the DOMNode JS object for an attribute name is complicated since the parser returns all attribute names in lowercase (since node.attributes reports them that way), even when the markup uses mixed case, ex: "noValidate".

Also, note that dojo.attr(node, "novalidate", true) doesn't work on IE6 because it's setting a boolean value where the attribute name has incorrect capitalization. So therefore new MyWidget({novalidate: true}) or even MyWidget({noValidate: true}) won't work correctly. However, new MyWidget({noValidate: ""}) will work, and that's what the parser does.

Refs #12476, fixes #13237 !strict.

Note: See TracTickets for help on using tickets.