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

@tkent-google 

Here is an actual example:

```html
<form>
<p>Select a maintenance drone:</p>

<div>
  <fancy-radio name="drone" value="huey">
  <label for="huey">Huey</label>
</div>

<div>
  <fancy-radio name="drone" value="dewey">
  <label for="dewey">Dewey</label>
</div>

<div>
  <fancy-radio name="drone" value="louie">
  <label for="louie">Louie</label>
</div>
</form>
```

There are two ways to implement that fancy-radio, a) extending input, b) wraping the input in a custom element that participates in the form. Option a) is really not an option ATM due to the limitations of the `is` attribute, so let's focus on b.

Making the 3 instance to participate in the form works great, each of them will override the `drone` value when needed by calling `setFormValue`, but the problem is really about the coordination between them to uncheck the others when a new one is checked without requiring the consumer to do this coordination manually.

As for the reset mechanism, yes, certainly listening for it at the form level will do the trick, but that has one issue for us: leaking the form reference is undesirable, in our case, at salesforce, we have extra restrictions on what you can see/observe. In our case, we will probably restrict `formAssociatedCallback` to prevent leaking that form. A callback (e.g.: `formResettedCallback`) works better for us.

In other words, we favor a solution that does not require interacting with the form element directly.

-- 
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-450018925

Received on Wednesday, 26 December 2018 20:11:12 UTC