Giter Club home page Giter Club logo

Comments (2)

joepuzzo avatar joepuzzo commented on September 27, 2024 1

hmm I would suggest making the buttons type="button" then calling two different fuctions depending on the button.

i.e

saveDraft = () => {} vs createBlog = () => {}

then inside of those I would call formApiRef.submitForm() and at this point your actual onSubmit can be called where you set some sort of flag based on function called

OR

you could NOT use two submit buttons and instead have a switch toggle input that says "Save As Draft" and be true or false.

from informed.

grimgoon avatar grimgoon commented on September 27, 2024

That makes sense, thanks, @joepuzzo!

Potentially, an idea could maybe be to allow you to pass an optional object to the submitForm() function in the future.

That would allow you to pass in custom data, and the submit function would then give you the formState as the first argument as normal, and your (optional) object as the second.

formApiRef.submitForm({isPublic: true})

from informed.

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.