- From: Alex Vincent <ajvincent@gmail.com>
- Date: Tue, 25 Aug 2009 00:50:48 -0700
I read this paragraph (from section 4.10.15.3) as self-contradicting: "The validationMessage attribute must return the empty string if the element is not a candidate for constraint validation or if it is one but it satisfies its constraints; otherwise, it must return a suitably localized message that the user agent would show the user if this were the only form with a validity constraint problem. If the element is suffering from a custom error, then the custom validity error message should be present in the return value." Specifically, the last sentence contradicts the rest of the paragraph. If there is a custom error, but the element is not a candidate for constraint validation, should the validationMessage attribute be empty, or should the custom validity error message be present in the return value? You can't have both. This inconsistency is somewhat worsened when you consider the user may call input.setCustomValidity("foo") on an element that isn't a candidate for constraint validation: <form action="javascript:void()"> <input disabled="true" name="foo" id="foo"/> </form> var foo = document.getElementById("foo"); foo.setCustomValidity("foo"); foo.willValidate // returns false, because of the disabled attribute "The willValidate attribute must return true if an element is a candidate for constraint validation, and false otherwise (i.e. false if any conditions are barring it from constraint validation)." foo.validity.customError // returns true foo.validity.valid // returns false foo.validationMessage // ??? Also, I noticed the readonly attribute for input elements overrides constraint validation, per section 4.10.4.2.3 - but the readonly attribute has no meaning for several input types (section 4.10.4, the big table after the IDL). For checkboxes, radio buttons, file uploads, image inputs, submit, reset and ordinary button types for the input element, readonly has no other effect. Please advise - I'm currently working on a patch for Gecko code which implements this. -- "The first step in confirming there is a bug in someone else's work is confirming there are no bugs in your own." -- Alexander J. Vincent, June 30, 2001
Received on Tuesday, 25 August 2009 00:50:48 UTC