Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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")
  }

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading