-1

I am new in React.js, and I am trying to figure it out how to set up some functionality in form.

What I trying to do is the following:

1) Delete the records/inputs after clicking on the submit button (After submitting the information, the records are stored in the database, but the record/inputs are still displayed in the form.

enter image description here

2) After clicking the submit button, I would love to receive the following message in order to let the user know that the information was successfully submitted

enter image description here

This is part of my code in my component:

enter image description here

Manfred Tijerino
  • 377
  • 1
  • 3
  • 12

1 Answers1

0

For value reset :

  1. Bind a custom function to the onSubmit form method, this function will reset the form value, submit the data and display the success alert

  2. Reset the field values using setState

  3. Submit the data using the API system you use

  4. Add a new boolean state to tell the page to display your alert or not.

  5. Set the boolean state to true in your submit method

  6. Add a display condition in the render method, displaying the alert if the boolean is set to true, and else nothing