Mobile Form - form.setData also sets form.initialData

I'm pre-populating a form based on a selection in select box. The form is populated using the setData method. When attempting to reset the normal way it fails as initialData is now loaded with the data that was loaded with setData.

I did find a workaround. Call the setData method of the form with a single element that's in your form like this:

form.setData({name:""});

In this case I have a field in my form called "name" which I just set to nothing and it resets the entire form to its defaults.

Side note: I have this same form wired up pretty much identically in a web app and the reset button does work fine without the workaround, so this is likely just mobile app specific.

Hey @philone, moved this here to a mobile specific topic. Can reproduce, and will submit a bug report to the team. This was resolved for the web app form, but as you noted still exists for mobile.

Thanks Joe. I've edited my post to remove the reference to being "an old post" since it's now new :slight_smile:

1 Like

Good tip! I’ve had the same problem with forms not resetting right after using setData. Didn’t know resetting one field could do the trick. Thanks for sharing! This will help with my SIM registration Globe setup.

Great tip! Resetting one field can really simplify things. If you're setting up for TNT too, check out on SIM register TNT and more!