Maybe a bug, maybe feature request. Should SC form data be reset when form is reset?

When calling serverconnectformid.reset() should the returned data/status etc. also be reset? If not, could an action be added to clear the data like the reset option does for ‘normal’ server connect calls?

If it is meant to be reset, it doesn’t seem to be working properly (PHP, W4.4.5):
image
As you can see data is still there after the reset

Happy to categorise under FR/bug once established…

I think someone posted this just last week.
Its a potential FR.
They used JS to clear out the object meanwhile.

1 Like

Have you tried adding the scform.reset() in code? I believe the SC form component inherits from the regular SC.

1 Like

Thanks buddy,
I can overwrite the data object in JS but thought the behaviour wasn’t quite right/could be improved…

Additional context.

Yeah, thanks. The SC reset works but doesn’t clear the data for a SC form

I checked the code and I was wrong. SC form doesn’t extend SC it extends the form component which has a reset method but doesn’t clear the data unlike the SC component.

1 Like

The data always shows the last result of the server action. The reset only resets the form.

Yeah but can a clear() action be added that clears the form AND resets the data?

I think that would be possible. I don’t think it is a good thing to change the current reset behavior, but having a different action for it would be ok.

Decided to update the reset action, seems that the server connect component also uses reset to unset the data, so having the same behavior in the server connect form seems logical.

dmxAppConnect.zip (25.6 KB)

Seems logical but as per your first post, there is a significant risk of existing pages behaving differently for people who have SC forms already in place - I’d say it’s probably a too commonly used function to be messing with. What about .reset() staying and something like .resetdata() or .cleardata()

This is a great addition.
Please be sure to mark it in bold in the update logs. :grin:

This makes me nervous. I use reset in probably 50+ forms on my main dashboard. Will this effect those forms?

I think changing the reset() is a huge mistake.

I use a LOT of forms with hidden text inputs that have vales bound to them. Right now the reset just clears forms that do not have a value bound to them. Will this change clear my hidden form inputs as well that have a value bound to them?

I am very scared of this change.

The new reset is just going to clear the scform1.data object. Existing form reset function remains as is.

The updated reset only clears the form.data, for the form fields it doesn’t change anything. I don’t think many users do even use the response data from the form submit and it seems logical that if you reset a form it should also reset the previous result.

I have used them in subsequent flows/JS - resetting all using .reset() is a significant behaviour change. If the form was set to reset before the flow/JS, they would subsequently not work following this change! I understand trying to consolidate to one consistent function but I suspect others may be in the same boat and find existing projects suddenly not working because of timing of the reset more than the reset itself.

I really look forward to and appreciate this change but just feel it could cause problems if not handled carefully

I’ve changed it to an extra argument in the reset action, normal form.reset() will reset form and form.reset(true) will also clear the data.

5 Likes