W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2014

[Bug 24603] New: [Custom]: Need callback for form submit data

From: <bugzilla@jessica.w3.org>
Date: Mon, 10 Feb 2014 16:09:15 +0000
To: public-webapps@w3.org
Message-ID: <bug-24603-2927@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=24603

            Bug ID: 24603
           Summary: [Custom]: Need callback for form submit data
           Product: WebAppsWG
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Component Model
          Assignee: dglazkov@chromium.org
          Reporter: arv@chromium.org
        QA Contact: public-webapps-bugzilla@w3.org
                CC: mike@w3.org, public-webapps@w3.org
            Blocks: 14968

<form>
  <my-custom-input name="abc"></my-custom-input>
</form>

Right now there is no way to have custom elements include data in form
submissions. We should add another callback for this

I believe we need to add a callback that is called before the submit event.

Strawman:

document.registerElement('input', {
  prototype: {
    __proto__: HTMLElement.prototype,
    beforeSubmitCallback: function() {
      switch (this.type) {
        case 'checkbox';
          if (this.checked)
            return this.value;
          return undefined;
        ...
      }      
    }
 }
});

Basically, the contract is that the return value of the callback is used a the
form value. If undefined is returned nothing is serialized.

This is of course a bit too simplistic but it might be enough to get started.

Things to keep in mind:

- Radio buttons need to check outside itself
- input[type=file]. Return Blob|File|data url?
- input[multiple]. Array of values?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
Received on Monday, 10 February 2014 16:09:18 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:14:21 UTC