As I understand Codigniter cache works on matching the URI. Therefore if caching is set in a method that contains a form it will display the empty form all the time.
Is there a way to set whether to display the cache file or render the view?
Pseudocode:
if form validation = FALSE
serve cache file
else
render view
endif
Also is there a way to check if the form is being displayed because it is the first load or if it is being displayed because there are errors?
Using the Codeigniter caching way, it is not possible to display from cache conditionally. Because Codeigniter decides to display from cache before calling the controller itself.
What you can do is to use your custom caching library. There are several caching libraries for Codeigniter. You can try https://github.com/philsturgeon/codeigniter-cache