Home › Forums › Front-end Issues › Blank/white page after submitting large acf_form
There are some users reporting that they are getting a blank/white page after they submit an acf_form on the front end of the website. The form is long and can sometimes take them a long time to complete – is their session ending, and if so, what’s the best way to keep the session alive?
The issue is most likely that it is timing out. Every field that is submitted means up to 4 and sometimes more DB queries. I find this happening on my sites mostly when there are complex repeater or flexible content fields. But if you have enough fields it could potentially happen even without using these types of field. A browser will only wait for 30 seconds for a request to send a response then it times out and results in a blank page.
The process is still going on the server and everything will happen, but the user will not know it.
Unfortunately there is not easy fix and your best bet is to reduce the complexity of the form. Maybe provide more than one form, but I don’t know how that would work.
Gotcha, I didn’t think I was the first person to come across this issue! The form has a repeater with 5 fields for each row so that wouldn’t help one bit.
All the form data is being saved even if the user get a blank screen so that’s good.
Would an AJAX submission of the form save the user from seeing the blank screen? Would the browser wait longer than 30 seconds to get a response from an AJAX request? At least then we can show the user a loading/progress bar saying something along the lines of “your entry is being saved, do not close this browser window” and then redirect once the save is complete?
5 fields in a repeater does not sound like a lot. How many rows are being submitted? How many other fields are there?
AJAX would not matter, you still need to deal with the timeout.
I should have asked first, but are you sure it’s timing out and not an error of some kind? I would turn on debugging and error logging and check to make sure there are no errors. There may not be enough fields to cause a timeout.
I actually have a plugin that does what you suggest but it’s not for everyone. But you have to make sure everything is error free before using it.
I think there’s an average of 13 rows being submitted. There’s 12 other fields (3 text, 1 Google Map, 2 groups with 3 and 2 text fields, 1 radio, 2 true/false). The redirect URL is the existing page’s URL with the post ID added to the end.
Understood re. AJAX and still needing to address the timeout.
I think it is a timeout, I can’t see any errors logged. How dangerous would it be to increase the max_execution_time on PHP to a minute? Strange thing is, even if the user gets a blank screen on submitting the form, all the form data is saved as a post as expected.
Would love to check out your plugin, where would I find it?
Thanks for always coming to the rescue John!
The data still being saved is normal. The server/PHP does not look to see if the browser has aborted the connection until output is created. When saving a post and fields no output is created until the process is completed. If everything is being saved then changing max execution time will not matter.
I should say that I’m not sure this will work on the front end. It depends the wp_redirect function being called. This is called in the admin when saving a post. I have never tried it on a front end form.
Understood, thanks John.
Would allocating more resources help the server save the data quicker so the timeout doesn’t happen? I can increase the memory and CPU limit of the hosting server.
Adding more resources might improve server speed. The biggest performance hit is caused by the DB queries. I don’t think there is much you can do about the time it takes to make the DB query/request and get the result.
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!
❓Ever wondered when and why ACF uses JSON instead of the database? Check out our summary of the most recent session of ACF Chat Friday for the answer, and make sure to register for the next session.— Advanced Custom Fields (@wp_acf) February 23, 2023
© 2023 Advanced Custom Fields.