[Webkit-unassigned] [Bug 28649] Support for interactive validation of form elements

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Aug 21 18:05:51 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=28649


Michelangelo De Simone <micdesim at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |19264
         Depends on|                            |28145, 27452




--- Comment #1 from Michelangelo De Simone <micdesim at gmail.com>  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;
}

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list