2

I'm playing with LitElement, trying to make some simple custom elements.

This is my app.js:

class MyInput extends LitElement {
    static get properties() {
        return {
            name: { type: String, reflect: true },
            innerVal: { type: String }
        }
    }

    constructor() {
        super()
        this.innerVal = ''
    }

    render() {
        return html`
          <input type="text" @keyup=${this.inputHandle.bind(this)} />
          <input type="hidden" name="${this.name}" .value="${this.innerVal}" />
        `
    }

    inputHandle(ev) {
        let { target } = ev
        this.innerVal = target.value + '__'
    }
}

customElements.define('my-input', MyInput)

And this is the form I've made:

    <form action="/action" method="POST">
        <div><my-input name="some_name"></my-input></div>
        <div><input name="just_input" /></div>
        <button type="submit">Submit</button>
    </form>

However, when I press "Submit", only the data from the just_input input is sent, but not from my custom input:

A cropped image from Firefox dev tools, displaying the submitted form data. It reads: "just_input: qqqq"

Why is my custom input value not being submitted?

Community
  • 1
  • 1
art-solopov
  • 4,289
  • 3
  • 25
  • 44

1 Answers1

1

As someone pointed out to me on Mastodon, as of now, it's not implemented. Relevant Github issue

art-solopov
  • 4,289
  • 3
  • 25
  • 44