Giter Club home page Giter Club logo

Comments (2)

stuffmattdoes avatar stuffmattdoes commented on August 16, 2024

I've also noticed that the submit button/element does not appear in formData object on submission events.
If a button is used to submit a form and also includes a name/value pair, it should be in FormData.

Read more here

Example

// JS
document
    .querySelector("form")
    .addEventListener("submit", (event) => {
        let formData = new FormData(event.currentTarget);
        formData.get('FirstButton') // should be reference to <button/> but is undefined
    });

// HTML
<form>
    <button name='FirstButton' value='FirstValue'>First</button> // Click
    <button name='SecondButton' value='SecondValue'>Second</button>
</form>

from form-participation.

michaelwarren1106 avatar michaelwarren1106 commented on August 16, 2024

I think this is a good feature request. I think that the submit() function could be updated to accept an optional submitter param, and also be updated to conditionally use form.requestSubmit(submitter) if it is available?

Regarding the request about FormData, the submitter is the second arg to new FormData(form, submitter) so when creating a FormData, you can add the submitter.

However, I think maybe the formValues() helper could also be updated to accept an optional submitter param so that param can be passed to the new FormData() construction that happens in formValues()

from form-participation.

Related Issues (14)

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.