Re: Form submission participation (was Re: Goals for Shadow DOM review)

Hi,

Ryosuke wrote:

> What if we added "formparticipant" boolean content attribute and fired
> "formdata" event during form submission to serialize data?
>
> This way, we can add more events like "validate" to support more
> features of builtin form elements.

Hmm, right, validation. In the model I have in my head, there are
roughly two kinds of custom form participants: custom form controls
(probably implemented with custom elements & other web components
features) and "application state" (JS objects with no corresponding DOM
presence but that nevertheless should be submittable).

Suppose in the first case we add a nonconfigurable boolean property to
Element. The engine inspects this property to determine validity, and
it's the responsibility of the component to keep the property up to
date. That way, we don't have to invoke userland JS when performing form
validation or when resolving :valid/:invalid style rules.

In the second case, I think we can just punt completely—form
participants that aren't Elements don't participate in validation, only
submission. Because it's the application's responsibility for
maintaining its own state, there's no sensible visual location in the
document to display a validation error, and no no-application-specific
way for the user to resolve the issue.

Thoughts?


Ted

Received on Friday, 21 February 2014 22:13:23 UTC