W3C home > Mailing lists > Public > whatwg@whatwg.org > April 2017

[whatwg] Adding progress event for native <form>?

From: Mikko Rantalainen <mikko.rantalainen@peda.net>
Date: Tue, 11 Apr 2017 15:44:39 +0300
To: whatWG <whatwg@whatwg.org>
Message-ID: <5882c1a6-955f-2853-9b38-d8d56939eccf@peda.net>
I see that https://xhr.spec.whatwg.org/ already defines ProgressEvent
for XMLHttpRequest.

Would it be possible to add "progress", "load", etc. events to normal
form elements, too? Basically, I would like to do

  form.addEventListener('progress', function (e) {...})

and if the end user hits the Submit button, my progress listener would
get called with ProgressEvent with lengthComputable, loaded and total
attributes.

If I have understood correctly, this does not make any information
available to JavaScript that is not already available because JavaScript
*can* already evaluate all form fields, use FileReader API to get all
the files in file inputs and submit the form to the same action URL
using XMLHttpRequest. In addition, browsers already implement all the
required code because XMLHttpRequest needs that behavior.

If listening for "progress" were allowed, I could implement my own form
submission UI and still use regular forms that would work even without
JavaScript.

-- 
Mikko
Received on Tuesday, 11 April 2017 12:45:25 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 11 April 2017 12:45:25 UTC