You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I created a simple form to check the behavior of inputs inside radio shadow DOM. If the input element inside, it's content not accessible with the form data
let form = document.querySelector('#radio-form');
form.addEventListener('submit', (e) => {
e.preventDefault();
const form = document.querySelector('form');
const data = Object.fromEntries(new FormData(form).entries()); //data is empty
});
Currently, the only way to get the value of the radio group is to subscribe to the event:
If we want ts-radio-group to work with the form data we can:
Use hidden <input> element instead of <ts-radio> inside <ts-radio-group> slot. Generate visual representation of those inputs with the<ts-radio> in the shadow DOM, and update the slotted input state on change. Requires major reimplementation of ts-radio-group component, to make it more reactive.
Generate hidden<input> with unique id element in the light DOM, next to <ts-radio-group>, like it's done in the weightless components. The simple and effective way. It can be easily implemented as the base class and could be used for any form element.
Make slot inside each of the radio element, and ask developers to put <input> inside the slot manually, if they need native forms behavior. Update <input> properties inside ts-radio logic.
I created a simple form to check the behavior of inputs inside radio shadow DOM. If the input element inside, it's content not accessible with the form data
Currently, the only way to get the value of the radio group is to subscribe to the event:
Or directly get value on submit:
If we want ts-radio-group to work with the form data we can:
<input>
element instead of<ts-radio>
inside<ts-radio-group>
slot. Generate visual representation of those inputs with the<ts-radio>
in the shadow DOM, and update the slotted input state on change. Requires major reimplementation of ts-radio-group component, to make it more reactive.<input>
with unique id element in the light DOM, next to<ts-radio-group>
, like it's done in the weightless components. The simple and effective way. It can be easily implemented as the base class and could be used for any form element.<input>
inside the slot manually, if they need native forms behavior. Update<input>
properties inside ts-radio logic.Originally posted by @kirill-kolombet in #221
The text was updated successfully, but these errors were encountered: