GithubHelp home page GithubHelp logo

FormData & submitter[formaction] about xhr HOT 6 OPEN

Lcfvs avatar Lcfvs commented on June 14, 2024
FormData & submitter[formaction]

from xhr.

Comments (6)

annevk avatar annevk commented on June 14, 2024 1

Alright, let's reopen this to see if more people hit this or if we find it to be a common library pattern or Stack Overflow question. Thanks!

from xhr.

annevk avatar annevk commented on June 14, 2024

It seems this would be rather magical as https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#constructing-the-form-data-set has an early return for an empty form. I guess we would have to pretend that the form contains the submitter in this case.

Perhaps you could elaborate on when this kind of thing has come up?

from xhr.

Lcfvs avatar Lcfvs commented on June 14, 2024

Sorry, my bad... Honestly, I just discovered that requirement: "Does nothing if there is no form owner."

Then a submitter can't be standalone, invalidating my question.

I'm self-asking why that required dependency but don't want to annoy you longer with that.

Thanks anyway.

from xhr.

annevk avatar annevk commented on June 14, 2024

You're not annoying me! Just curious. I think the dependency is there because we get the fields from the form and then the submitter identifies the field that is the submitter. As I suggested above we could potentially invert some of that, but would need a compelling use case and some signal of web developer demand.

from xhr.

Lcfvs avatar Lcfvs commented on June 14, 2024

Ok, ok :)

In fact, actually, the idea behind to use them, as standalone, is to replace some anchors by some button[formaction]...

  • to avoid any risks related to the page preview feature of some browsers (AFAIK like planned for Chrome)
  • to have a "dynamic" variable sent to the server, based on the attributes (name & value), without to have something to manage it, even in GET/POST and/or in AJAX or not

And, really, I'm not convinced about the need of an extra form, trailing somewhere in the page to be able to send one of these buttons requests... moreover since it requires an id, "polluting" the globalThis for that... where these buttons can have anything we need to perform the requests, alone.

from xhr.

Lcfvs avatar Lcfvs commented on June 14, 2024

Thanks a lot for that shared curiosity :)

from xhr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.