Ability to submit invalid forms

I have a broad question, under HTML 5 is it possible to enable validation
on a form, with all the built in User Agent highlighting and reporting
that we are expecting but ultimately still allow it to be submitted to the
server?

Essentially i'd like to be able to have HTML5 alert the user to errors and
omissions in the form but still allow I (the web site owner) to determine
seperately if I want to allow it to be sent to the server.

This may seem like a bizzare situation to allow but I can think of a
number of examples off the bat. The first is a simple blog post form that
requires a title to be entered but also allows the user to attach a photo.
There may be a seperate button in the form for uploading the image (and
thus POSTing the form) and the user may be allowed to do this even if the
title is not (yet) filled out.

This first scenario still confines the validation of the form to a single
session,  how about we allow the user to Save the blog post in their admin
area but not Publish it? Organisations may use a CMS to create a press
release, but not publish it until a certain date. While it is being
prepared it may be saved to and retrieved from a database and - NULL data
column issues aside - may still be missing the required Title field.

Alternately an individual may fill out an online application form for a
loan on their banking site but not have a key piece of information to
hand. They may then save the form within their online account, close the
laptop, go to work, log in from their desktop, complete the form then
submit it. In the interim the form's contents may be invalid.

Now one can imagine that the workaround in either of these cases would be
to have the final Submit button invoke validation (client and/or server
side) and a Save button to simply store the data for later but a blanket
HTML 5 can't-submit-until-valid  approach would deny the author from being
able to leverage the full capabilities of HTML5's builtin validation
abilities.*

The Chan web engine solves this by allowing the Publish button to have a
ValidateForm attribute set to true and the form have an AutoValidate
attribute set to false. This allows a user to do all manner of operations
on a form causing any number of postbacks or ajax updates and only have
the final commit be subject to the full validation.

Thoughts?





* That's the first time I've used "leverage" in a sentence!



Ric Hardacre cyclomedia.co.uk

Received on Tuesday, 8 December 2009 13:04:45 UTC