Form Reset is not working

  • Goal: Trying to get this form to reset after submitting.

  • Steps: basic form with a few fields. some have default values, but 2 fields need to be reset to empty. clearing seems to also remove default values so that doesn't work.

  • Details: Table1 (for foreign key), Form Component, Modal Component, Insert Query

  • Screenshots:
    this doesn't work


    so I had to do this and clear the fields individually
    image
    image

Hi @Shegs,
You should be able to Reset the entire form. On submit add an event handler as below.

chrome_jtyxEHd7Mx

tried that before trying individual fields. no-go.

the submit reset has worked on previous apps, no idea why it isn't working here.

Strange.

Is it a new multipage app? If so, make sure the queries and components are on the correct page. I'm still seeing strange behavior with the new multi-page apps.

If you want to send a json export I could do some testing.

Very strange indeed. Instead of adding an event for every field in your for you can run script as in the example below. At least this will be faster to code.

chrome_uZRUzkMyMU

I'll give that a god for now

1 Like

Hello @Shegs,

You need to trigger the form on the query's success to clear and reset all input fields inside it.
Here's the screenshot for your reference:

3 Likes

Are you using setData at all, or something else, to populate the values in the form or is it always "empty"?
I've often run into issues with initialData and setData not playing well together so that reset() doesn't "reset"

I have 2 fields of this form (4 total) that have a default value set.
a check box using a JS Query:
image
image

and a foreign key field that loads the source table's primary key:
image

this worked.
just seems odd that the successful submit reset doesn't.

Thanks

Throwing this in here because I just made the mistake myself (PEBKAC)

Was the query saved when adding form reset/clear handlers? I didn't and pulled my hair out for a few submissions.

although I do make that mistake quite often, this time it was saved.