Hey guys,
I’m currently facing a rather unique issue with a client request.
We’ve built a small wordpress website for our client to log parking violations in various car parks. So far we’re using Gravity Forms to have the employees submit entries and edit them afterwards.
No the client wants the whole thing to work while offline, since there’s not always good connection in the car parks.
That’s where the problems start. I was able to setup a pwa on wordpress and check the online status. If we’re offline, I’m saving the entry data to local storage and as soon as we’re back online we’re sending the data via gravity forms rest api.
The gravity forms api however can’t process images, which we desperately need. So my solution is switching to ACF with front end submission pro plugin to easily create the form and be able to edit entries.
Since ACF is so complex however, I’m kind of stuck on the workflow of checking the connection status and if offline, save the data to local storage and send it once back online.
The idea is: hook into acf/save_post and check connection status using the running pwa plugin. If offline, save $_POST contents to local storage and stop form submission by returning null. Once back online, read load $_POST from local storage and run acf/save_post again.
My issue with that: I wasn’t able to fully track image submission in acf and all the other things going on when submitting. In Gravity Forms, I simply wrote the whole thing in javascript, but here using the action hook I need to switch to php.
So I guess my question is: Has anyone here realized something similar or has any insight/tipps on how to implement this for multiple form submissions while being offline and submitting all data once the connection is reestablished?
Thanks guys!
All I can really do is point you to the JS API docs https://www.advancedcustomfields.com/resources/javascript-api/
There is an action that can be added to alter the submit action. This discussion might be of interest to you https://support.advancedcustomfields.com/forums/topic/js-api-broken-in-5-7-13/
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We’re reaching out to our multilingual users to ask for help in translating ACF 6.1. Help make sure the latest features are available in your language here: https://t.co/TkEc2Exd6U
— Advanced Custom Fields (@wp_acf) May 22, 2023
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.