Re: [w3c/webcomponents] Need callback for form submit data (#187)

[Minutes of Spring 2019 F2F](https://www.w3.org/2019/04/25-components-irc#T20-38-19)

### Re: Form-associated non-custom elements, ```ElementInternals``` for built-in elements

It is an issue independent from form-associated custom element. So we can discuss it after finishing this issue.
We need to take care of many edge cases.  I'm afraid it will make the specification and implementations much complicated.

### Re: Form validation for compound controls

Suppose that we have a form-associated custom element with three internal fields.

```html
<card-input required>
  #shadow-root
    <input id=cardno required>
    <input id=expiration type=month required>
    <input id=cvc pattern="[0-9]+" required>
</card-input>
```

The owner ```<form>``` of ```<card-input>``` doesn't take care of these internal fields at all.  So the implementation of ```<card-input>``` should call ```ElementInternals.setValidity()``` if one of them is invalid.

Validation UI would have a trouble.  The current proposal and the Chrome implementation just show a validation UI on ```<card-input>```.  However, it should be shown on an invalid internal field.
A possible solution would be to add an optional ```Element``` argument to ```ElementInternals.setValidity()```.   ```this.#internals.setValidity({valueMissing: true}, 'Please fill out this field with the expiration month of the card', this.#expiration);``` will show a validation popup on ```expiration``` field.

What do you think?


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/187#issuecomment-486890626

Received on Friday, 26 April 2019 01:15:46 UTC