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

147
Views
How to detect if the form has been submitted?

I have form in react.
And I need to detect if the form has successfully been submitted to make a next request in another form

const formRef = React.useRef<HTMLFormElement>(null);

  useEffect(() => {
    if (formRef && formRef.current) {
      formRef.current.submit();
    }
  }, [formRef]);

 <>
          <form
            id="tdsMethodAcs"
            method="post"
            target="methodAcsFrame"
            action={three_ds_method_url}
            style={{ display: "none" }}
            ref={formRef}
          >
            <input
              type="hidden"
              name="methodAcsFrame"
              value={method_data_packed}
            />
            <input type="submit" />
          </form>
          <iframe name="tdsMethodAcsFrame" width="0" height="0"></iframe>
        </>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Probably the shortest way is to create a variable in the state to which you change the value when the form is submitted. Somethink like this:

const [formSubmitted, setFormSubmitted];
const onSubmit = () =>{
  //Do stuff
  setFormSubmitted(true);
}
useEffect(()=>{
   //Do another stuff
},[formSubmitted])
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!