Reset cursor on form

I have a form that I’d like to reset when the user submits and place the cursor right back to where it started when the page loaded, but without having to refresh the page. The person using this interface is scanning items in with a barcode scanner and they sometimes need to enter a few hundred items.

Is there any function we can use to reset the focus back to the first field when submitted (or the last field is tabbed off)? Or a creative way to build this page that satisfies this use case?

Hey there!
Are you using the default form or a JsonForm in your UI?

I think you can use resetWidget to solve this - Reset Widget | Appsmith

@pranav I’m using the regular form not the JsonForm, although I could swap JsonForm if it solves my problem.

I tried using resetWidget and couldn’t make that work. The method I used was to set resetWidget for the entire form onBlur and onSubmit, and I also tried that with a button inside the form and a button outside the form. I tried both with the children modifier for resetWidget as true and as false. In no combination did I see the focus actually change.

Tested in edit, preview, and deployed.

I also tried setting the Auto Focus feature to JS and set it based on a stored value, then had other widgets change the stored value. That also did not cause the focus to change.

I’m starting to wonder if I need to make this form into an iframe to handle this.

@EricSGS That may be the best workaround for now if moving the cursor is a hard requirement.

Could you please help us file a feature request/bug using the following link?

New GitHub Issue

Please include your use case and how it will be useful for you.