WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED DUPLICATE of
bug 164382
28649
Support for interactive validation of form elements
https://bugs.webkit.org/show_bug.cgi?id=28649
Summary
Support for interactive validation of form elements
Michelangelo De Simone
Reported
2009-08-21 17:53:44 PDT
Support for interactive validation of form elements, HTML5 specs section 4.10.15.2, is necessary.
Attachments
Demo patch
(21.45 KB, patch)
2009-09-02 02:43 PDT
,
Kent Tamura
tkent
: review-
Details
Formatted Diff
Diff
Incomplete patch (rev.0)
(20.87 KB, patch)
2009-10-06 00:06 PDT
,
Kent Tamura
abarth
: review-
tkent
: commit-queue-
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Michelangelo De Simone
Comment 1
2009-08-21 18:05:50 PDT
Some tip from other bugs this depends on: 1. Form control elements can be in a "no-validate state" that is controlled by "novalidate" and "formNoValidate" attributes, plus some more condition. This snippet could be of help: bool HTMLFormControlElement::isInNoValidateState() const { return (isSuccessfulSubmitButton() && formNoValidate()) || m_form->novalidate(); } 2. HTMLFormElement::checkValidity() needs to be adapted to deal with "unhandled invalid controls" (as per TODO comment). Actually it just iterates over form elements calling checkValidity() (that fires the invalid event, as per specs), but it must also return a list of invalid form controls that haven't been handled through the invalid event. The following snippet might be of some help (was part of the proposed patch for
bug 27452
): bool checkValidity(Vector<HTMLFormControlElement*>* unhandledInvalidControls = 0); bool HTMLFormElement::checkValidity(Vector<HTMLFormControlElement*>* unhandledInvalidControls) { Vector<HTMLFormControlElement*> invalidControls; for (unsigned i = 0; i < formElements.size(); ++i) { HTMLFormControlElement* control = formElements[i]; if (control->willValidate() && !control->validity()->valid()) invalidControls.append(control); } if (invalidControls.isEmpty()) return true; for (unsigned n = 0; n < invalidControls.size(); ++n) { HTMLFormControlElement* invalidControl = invalidControls[n]; bool eventCanceled = invalidControl->dispatchEvent(eventNames().invalidEvent, false, true); if (eventCanceled && unhandledInvalidControls) unhandledInvalidControls->append(invalidControl); } return false; }
Kent Tamura
Comment 2
2009-08-28 01:38:14 PDT
I have started implementation.
Michelangelo De Simone
Comment 3
2009-08-28 04:02:37 PDT
(In reply to
comment #2
)
> I have started implementation.
Good! I think you'll be needing support for the validationMessage for interactive validation step 3 (4.10.15.2) [
bug 27959
], I'm gonna speed it up.
Kent Tamura
Comment 4
2009-08-28 06:59:15 PDT
> Good! I think you'll be needing support for the validationMessage for > interactive validation step 3 (4.10.15.2) [
bug 27959
], I'm gonna speed it up.
That's right! The implementation requires validationMessage().
Kent Tamura
Comment 5
2009-09-02 02:43:15 PDT
Created
attachment 38918
[details]
Demo patch A workable demo patch. This is not ready to be reviewed. It has no tests and it depends on
bug#27959
and
bug#28868
.
Kent Tamura
Comment 6
2009-09-08 00:05:42 PDT
I'll use Balloon Tooltip for Windows to show validation messages.
http://msdn.microsoft.com/en-us/library/bb760250(VS.85).aspx
I don't know if Mac OS has a corresponding control.
Kent Tamura
Comment 7
2009-10-06 00:06:46 PDT
Created
attachment 40698
[details]
Incomplete patch (rev.0) I'd like to ask comments on the patch though it is incomplete. The patch will add the following behavior: - Show/hide a validation message when an invalid form control gets/losts the focus The way to show messages depends on each of platforms. - Prevent a form submission if the form has invalid controls TODO: - Add tests - Build file changes for other platforms - Provide ChangeLog.
Adam Barth
Comment 8
2009-10-18 22:43:40 PDT
Comment on
attachment 40698
[details]
Incomplete patch (rev.0) As you say, the patch is incomplete. No ChangeLog. No tests. If you'd like feedback on this patch, I recommend asking the relevant people on IRC or email. Having this patch in the review queue just makes it harder to review complete patches.
Kent Tamura
Comment 9
2009-11-20 04:17:29 PST
I split this to 3 patches.
Bug#31716
,
Bug#31718
and this will have patches.
Alexey Proskuryakov
Comment 10
2010-06-25 13:50:40 PDT
I think that form validation should be disabled until: - a solution is found for the compatibility problem with "required" attribute name; - UI for correcting problems is implemented (as tracked by
bug 31718
/
bug 40747
). Currently the user experience is just horrible.
Brenton
Comment 11
2010-06-28 11:58:43 PDT
I agree with Alexey. In 2008, I wrote an app to the HTML5 spec, then backported the validation API to JavaScript to support then-existing browsers. I've seen the app break a couple of times due to changes in WebKit (which Tamura is always eager to fix). If you go to
http://beta.insightdining.com/surveys/limon/
without the WebKit validator, the page scrolls smoothly to take you to an invalid element on form submission. Since the validation constraints have been added, the page abruptly jumps to the first invalid <input/>. I'm sure there are users who don't understand what's going on when this happens. For that matter, I wasn't even sure what was going on when I was debugging #40591.
Alexey Proskuryakov
Comment 12
2014-09-08 23:29:17 PDT
***
Bug 80419
has been marked as a duplicate of this bug. ***
Alexey Proskuryakov
Comment 13
2014-09-08 23:29:25 PDT
***
Bug 136595
has been marked as a duplicate of this bug. ***
Alexey Proskuryakov
Comment 14
2015-03-18 22:25:42 PDT
***
Bug 142817
has been marked as a duplicate of this bug. ***
Haralan Dobrev
Comment 15
2015-04-21 09:12:33 PDT
This ticket was created as an enhancement, but the last few tickets which were marked as duplicate to this are more critical. It seems this problem now affects normal validation and not only the JavaScript API. IMHO the priority/importance of this ticket should be increased.
Darin Adler
Comment 16
2015-04-21 15:13:30 PDT
This always affected “normal validation”, not just JavaScript API, and that validation is a new feature, and one that is not implemented yet in WebKit. I understand that you would like to see the feature!
Alexey Proskuryakov
Comment 17
2016-06-04 12:57:06 PDT
***
Bug 158331
has been marked as a duplicate of this bug. ***
Amanda
Comment 18
2016-09-30 14:56:12 PDT
Is anyone currently working on this? It was submitted 7 years ago, and Safari is now the only browser whose current version will submit a form with invalid constraints.
Radar WebKit Bug Importer
Comment 19
2016-10-05 11:57:39 PDT
<
rdar://problem/28636170
>
Chris Dumez
Comment 20
2016-12-08 13:50:22 PST
*** This bug has been marked as a duplicate of
bug 164382
***
Chris Dumez
Comment 21
2016-12-08 13:53:58 PST
(In reply to
comment #18
)
> Is anyone currently working on this? It was submitted 7 years ago, and > Safari is now the only browser whose current version will submit a form with > invalid constraints.
Safari Technology Preview 19 has this enabled:
https://webkit.org/blog/7093/release-notes-for-safari-technology-preview-19/
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug