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

130
Views
function is not defined when im trying to call a function inside my onsubmit function

i have this form say

<form onSubmit={this.formSubmit} id="userForm" name="myForm" noValidate>

im trying to call another function inside my formsubmit() function but it says the function is not defined . what could the reason be

   formSubmit=(e)=>{
    e.preventDefault();
    validateForm();
  }
  validateForm=()=>{
    console.log("test")
  }
about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

You need to call this.validateForm(). validateForm is bound to the component instance.

about 4 years ago · Juan Pablo Isaza Report

0

formSubmit and validateForm are methods of your (component) class, not an independent function. In order to call the inside of the class, you need to call it through the this keyword as it is bound to the class.

about 4 years ago · Juan Pablo Isaza Report

0

You are using this key word in the Component it seems. this key word has varying scope depending on where you are using it.

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!