Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

235
Views
React Semantic UI Form - Two submit buttons

I'm pretty new at ReactJs, I'm trying to submit a form, but one of the form values must depend on which submit button triggers the submit

I've coded something like this

<Form onSubmit={(e) => {
        e.preventDefault();
        const {target} = e;
        console.log('FormData', Object.fromEntries(new FormData(target)));
      }}>
... form fields ...
<Button icon="thumbs up" type="submit" content="Authorize" name="status" value="A" positive />
<Button icon="thumbs down" type="submit" content="Reject" name="status" value="R" negative />
</Form>

The log shows all form values correctly but the "status" field. Is there any way to achieve the expected behaviour? Any alternative is very welcome

Thank you

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can get the status value from the submit button on the event.submitter property and append this to the FormData.

See this answer for more info:

https://stackoverflow.com/a/64857928/681058

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!