I am using the mobile app on moodle3.5 to enable a custom plugin we have built. The issue that I am having is posted form data from a template is cached and refreshing the page will resubmit the same posted form data.
The dev structure that I am using is as per https://docs.moodle.org/dev/Mobile_support_for_plugins, using the php functions and templates with ionic components. I need a way to clear the form data somehow so that if the user refreshes the page no duplicate requests are handled.
Any help would be hugely appreciated
Any updates on this one?
Thank you for getting back to me. I am sending data with a mustache template form that is using the
I think you should use the directive core-site-plugins-call-ws-new-content or core-site-plugins-call-ws instead of core-site-plugins-new-content. These directives will call a WebService that should create the forum post (you will have to implement that WebService), and when the WS call is done you should then open a new view with the discussion. The new view will only fetch the discussion data, it won't send the post data, so the post won't be created over and over again.
Great thank you for the feedback. I did see those directives but thought it would involve more code essentially in terms of what needs to be done and thought it to be over engineering. In hindsight it seems that it is the only way to properly post data without causing duplicates.
Thought there was an easy way to clear the post data on successful post.
Thanks so much Dani