How do I reset a form once a record has been submitted on reactive
Question

I created a simple FAQ app and when a user enters a question and answer they click submit.  This updates the table but the data in the form is not cleared out and subsequent entries seem to edit the same record.  How to I deal with this in a react app?

Solution

@JayPea

Were you able to solve your issue? Basically just check the variables that are behind your form fields, and make an assign right after the save record where you clean those variables to their default values!

Cheers,

Paulo

Hi JayPea,

You'll need to set the inputs field variable values to a null value.

like for date type variable NullDate(), text type variable to "" and so on.

Thank you for your reply. Not sure I follow 100% as I thought the CreatOrUpdate waffle function would take care of all that?

The entity action CreatOrUpdate just creates or updates a record in the database. Then we'll have to perform everything manually connected to the form.

Hi JayPea,

In the submit action you can use Current screen as a Destination, It will reset the form.

Hope this helps.


Regards

Rahul Chavan


Hi,

So this is fixing part of the problem in that the questions aren't getting over written but the fields still aren't clearing.  If I click submit again though it just creates a new duplicate question.  So it's a step in the right direction.

Also in the screen window I didn't have an option for CURRENT SCREEN so just selected the screen name for the current screen which I assume should do the same thing.


mvp_badge
MVP

Hi @JayPea ,

its depend on you, how you created a form if you are using individual local parameters than you need to reset value one by one or if you created a from by using source like aggregate by ID then you need to reset ID only.


Regards

Rahul

Hi Rahul,

Thank you for your reply.

So I am using a form which I generated from the DB table. The variables in the form are all getVeriables.

Beneath the form I have a list to display the questions and answers.  This is populated from an aggregate GetFAQById.

Solution

@JayPea

Were you able to solve your issue? Basically just check the variables that are behind your form fields, and make an assign right after the save record where you clean those variables to their default values!

Cheers,

Paulo

Thanks I did resolve it.  What threw me was the variables that were auto assigned to the form. Out systems assigned get variables so I overwrote these with my own variables then in the submit assigned my variables to the get variables.  I think it's because I used the form generator with a DB table rather than the aggregate maybe? Not sure, anyway now solved thanks.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.