Moodle for mobile

Mobile app caches form post data

 
Picture of Dani Palou
Re: Mobile app caches form post data
Core developersMoodle HQParticularly helpful MoodlersPlugin developers

Hi,

sorry for the delay in answering.

How are you sending the form data to the server?

Can you send me a link of the template so I can see what are you doing exactly?

Cheers,

Dani

 
Average of ratings: -
Picture of JJ Swanevelder
Re: Mobile app caches form post data
 

Hi Dani,

Thank you for getting back to me. I am sending data with a mustache template form that is using the 

core-site-plugins-new-content decorator. I will upload a basic template of this and the function that handles the form in mobile.php. The issue in this example is that when you create a new "discussion" all works fine but if you refresh the page it creates a duplicate.

I have tried unsetting the form post data and clearing the global $_POST variable on successful post but none worked.

Thank you again for any assistance.

Picture of Dani Palou
Re: Mobile app caches form post data
Core developersMoodle HQParticularly helpful MoodlersPlugin developers

Hi,

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.

Kind regards,

Dani

 
Average of ratings: -
Picture of JJ Swanevelder
Re: Mobile app caches form post data
 

Hi,

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 smile

 
Average of ratings: -