Anne van Kesteren

Web Forms 2 submitted to the W3C

Yesterday Web Forms 2 has been published as a submission on w3.org: Web Forms 2.0 — W3C Member Submission 11 April 2005. The W3C also published comments on the submission. You can also read about this on the site of WHATWG in the fourth call for comments.

Web Forms 2 is an extension to HTML and XHTML 1. It introduces various new values for the TYPE attribute on the INPUT element. You can now use url or email for example to indicate that the form control is meant to be used for those instances. (User input is validated against the type of form control by the user agent.) Using a REQUIRED attribute you can tell the user agent to not submit the form until all form controls with a REQUIRED attribute set are satisfied, et cetera. There are lots of new options and all are designed to be backwards compatible with even text browsers.

The cooperation with the W3C will most likely not slow the process down. It is expected that this is the last call for comments and that there will be very few if not none comments on the draft. After that a call for implementations draft will be published and user agents can start implementing the new features. For Mozilla one person is doing some work on the moment on a separate branch. I’m not sure when it will land, but I guess it will take some time. I think Opera is working on it as well and Apple might be doing something too. (Note that Apple didn’t submit it to the W3C along with Mozilla and Opera because the decision had to be made quickly on some conference. You can read about it if you desire.

Comments

  1. Looks very interesting. This would really make it a lot easier to create interactive web pages with far less scripting.

    Posted by Jero at

  2. This is very good news, I'm very pleased that the W3C is finally involved, though I would have preferred they were involved much sooner. I guess this means I'd better hurry up and work out whether or not my few remaining issues are still worth taking up or not, and speak now or forever hold my peace. :-)

    Posted by Lachlan Hunt at

  3. If the W3C was involved sooner, it probably would not have worked out. Actually, the W3C rejected the work when Ian Hickson tried to do it via the W3C.

    Posted by Anne at

  4. Look nice. But some changes seem unnecessary, e.g. why one will want to put form element inside the head element? input[type="datetime"] is cool, but what about localized datetime? Have to be English only? :-/

    Posted by minghong at

  5. User input is validated against the type of form control by the user agent... Using a REQUIRED attribute you can tell the user agent to not submit the form until all form controls with a REQUIRED attribute set are satisfied, et cetera.

    [...]

    There are lots of new options and all are designed to be backwards compatible with even text browsers.

    So how does that one work then? If it's backwards compatible, it means that you can't guarantee that the client will have already checked and validated the form. Does that not mean we would still be stuck with the same old server-side checks?

    Posted by Andrew Hayward at

  6. minghong, there is also datetime-local. However, note that Web Forms 2 defines controls, not the user interface.

    Andrew, for those browsers, yes. However, you could enhance the user experience a lot by adding client side validation. (Using the form controls described without having to write complex javascript to do the job for you.) It is the same as with all other things that are backwards compatible. With Netscape 4 you can browse a site using CSS and semantic markup but you are pretty sure you don’t get to see all the fancy stuff, if any at all.

    Posted by Anne at

  7. What about being compatible with IE 5/6? Can it fall back to a usual text input?

    Posted by Patrys at

  8. It appears the extension only adds new features. So yes, it should also work in IE5/6.

    Posted by Jero at

  9. The default value for unrecognized or invalid TYPE attribute (when applied to INPUT) values is text. Therefore type="url" will always fall back to type="text" in browsers that do not support Web Forms 2.

    Posted by Anne at

  10. The cooperation with the W3C will most likely not slow the process down.

    Which means this will actually be finalized sometime in 2008. Add a year for Opera and Mozilla support, and Microsoft might get to it sometime after my unborn babies have babies. And then by the time everyone upgrades those browsers I'll be dead and rotting!

    I just wish these things didn't move like glaciers. This is the internet! It's supposed to birth a world of instant gratification! :)

    Posted by Foofy at

  11. minghong: For type="date", the user agent is supposed to take the ISO8601-formatted date in the value attribute and convert it into a localized form. It would then convert it back to ISO8601 just before submitting the form.

    Anne: With regard to the type attribute, the default type for unknown type values should be text, but that does not mean that it must be text, so in theory there may be a situation where the user agent could do something else and still be compliant with HTML 4.01. (I can't think of an actual case where this would happen, though.)

    Foofy: My impression was that WHATWG wants WF2 implementations by the end of this year. My guess is that mid-2006 would be the latest you'd see an implementation on Opera or Mozilla. WHATWG is just giving the W3C a chance to add their own input to the spec before the start of the implementation phase.

    Posted by Matthew Raymond at

  12. Does that not mean we would still be stuck with the same old server-side checks?

    Andrew, server-side validation will always be necessary. You can never guarentee that a user agent will submit only what you want with client side checks. The only difference between these new markup methods and JavaScript is that the markup is supposed to be simpler to use, but (like JavaScript) browser support can never be guarenteed.

    Posted by Lachlan Hunt at

  13. Matthew, as far as I know HTML4 does not say should or must for that, to quote: This attribute specifies the type of control to create. The default value for this attribute is text.

    Posted by Anne at

  14. That's for types that are undefined, not unknown. So if you don't include a type attribute, it's text. However, the spec says that if an attribute value is unknown or invalid, the user agent should, rather than must, use the default value.

    Posted by Matthew Raymond at