Calling FormIt uncached, i.e with ! shows a blank page

I have the following FormIt call

[[FormIt? &hooks=`recaptchav3,email,FormItSaveForm,redirect` &emailSubject=`Enquiry Form` &emailTpl=`contactResponse` &formName=`Contact Form` &formEncrypt=`1` &store=`1` &redirectTo=`170` &emailTo=`someone@someone.net` &emailfromname=`info@somewebsite.com` &validate=`nospam:blank,name:required,phone:required,email_address:email:required,message:required,agree:required` ]]

As you can see I have called it cached [[FormIt? instead of [[!FormIt. The problem is every time i add the uncached ! in it outputs a blank white page. I have other calls in the form with ! in them e.g. value="[[!+fi.name]]" which don’t cause an issue. Can anyone point me in the right direction as to why the call with the ! outputs a blank page and how can I fix it. Obviuosly without the ! it won’t redirect, save the form etc. I have tried removing the hooks to a simple redirect but still does the same. It also does the same on another form I have created as well and if I create any new forms.

Anyone got any ideas ads to why it is doing this. Thanks

It could be there’s an error been made since it was cached. So without the ! it’s showing the cached version from when it was working.
Are there any errors in the log when you try to run it uncached?

Thanks for the reply. I have manually cleared all the cache and browser cache. It worked on the dev site (and still is), but once I moved it over to the live server it stopped working. The only difference is that the dev is MariaDB and live MySQL, but I can’t see how that would affect it everything else is running fine. There are nor errors thrown when I run it cached or uncached, just the blank screen.

You might try taking out all the hooks and validation rules. If that fixes it, you can put them back one at a time until it breaks.

Before doing that, I think I’d try just removing the Captcha.

1 Like

As well as doing what @bobray suggests, check both the MODX error log as well as the server error logs. There should be an error somewhere if it’s crashing the page.

Thanks for all the suggestions, I have tried all of the above but get the same result. I can remove everything and just have [[!FormIt ]] and I get the blank page. If I have an empty template and add that I get a blank page. Other snippets are fine, I tried the login snippet [[!Login]] and it works, no errors.

Error log below.

[2020-09-13 14:02:56] (ERROR in modMenu::getSubMenus @ /home/ministryofcraft/public_html/core/model/modx/modmenu.class.php : 148) modAction support is deprecated since version 2.3.0. Support for modAction has been replaced with routing based on a namespace and action name. Please update the extra with the namespace quip to the routing based system.
[2020-09-13 14:02:56] (ERROR in modMenu::getSubMenus @ /home/ministryofcraft/public_html/core/model/modx/modmenu.class.php : 148) modAction support is deprecated since version 2.3.0. Support for modAction has been replaced with routing based on a namespace and action name. Please update the extra with the namespace gallery to the routing based system.
[2020-09-13 14:02:56] (ERROR in modMenu::getSubMenus @ /home/ministryofcraft/public_html/core/model/modx/modmenu.class.php : 148) modAction support is deprecated since version 2.3.0. Support for modAction has been replaced with routing based on a namespace and action name. Please update the extra with the namespace formitlog to the routing based system.

Just tried removing it all together, purging all old packages, checking no chunks, snippets or plugins were left and then reinstalled and I still get the same issue. Just can’t work it out.

Turned on PHP errors in cPanel and get the below on a test page. Anyone any ideas how to fix? Thnaks

Fatal error : Uncaught Error: Class ‘Sterc\FormIt’ not found in /home/ministryofcraft/public_html/core/components/formit/model/formit/formit.class.php:28 Stack trace: #0 /home/ministryofcraft/public_html/core/xpdo/xpdo.class.php(656): include_once() #1 /home/ministryofcraft/public_html/core/xpdo/xpdo.class.php(627): xPDO->_loadClass(‘FormIt’, ‘formit’, false, ‘/home/ministryo…’, true) #2 /home/ministryofcraft/public_html/core/cache/includes/elements/modsnippet/116.include.cache.php(38): xPDO->loadClass(‘formit’, ‘/home/ministryo…’, true, true) #3 /home/ministryofcraft/public_html/core/model/modx/modscript.class.php(76): include(’/home/ministryo…’) #4 /home/ministryofcraft/public_html/core/model/modx/modparser.class.php(537): modScript->process(NULL) #5 /home/ministryofcraft/public_html/core/components/pdotools/model/pdotools/pdoparser.class.php(273): modParser->processTag(Array, true) #6 /home/ministryofcraft/public_html/core/model/modx/modparser.class.php(251): pdoParser->processTag(Array, true) #7 /home/ministryofc in /home/ministryofcraft/public_html/core/components/formit/model/formit/formit.class.php on line 28

Thank you Mark. The solution by markim1 fixed the problem in that the form now shows - https://github.com/Sterc/FormIt/issues/179#issuecomment-478873819 - but I now get the error below which I assume is similar but after adding in the same code to the fivalidator.class.php it still won’t redirect or submit the form.

atal error : Uncaught Error: Class ‘Sterc\FormIt\Validator’ not found in /home/ministryofcraft/public_html/core/components/formit/model/formit/fivalidator.class.php:34 Stack trace: #0 /home/ministryofcraft/public_html/core/xpdo/xpdo.class.php(656): include_once() #1 /home/ministryofcraft/public_html/core/xpdo/xpdo.class.php(627): xPDO->_loadClass(‘fiValidator’, ‘formit.fivalida…’, false, ‘/home/ministryo…’, true) #2 /home/ministryofcraft/public_html/core/components/formit/src/FormIt/Request.php(290): xPDO->loadClass(‘formit.fivalida…’, ‘/home/ministryo…’, true, true) #3 /home/ministryofcraft/public_html/core/components/formit/src/FormIt/Request.php(248): Sterc\FormIt\Request->loadValidator() #4 /home/ministryofcraft/public_html/core/cache/includes/elements/modsnippet/116.include.cache.php(45): Sterc\FormIt\Request->handle(Array) #5 /home/ministryofcraft/public_html/core/model/modx/modscript.class.php(76): include(’/home/ministryo…’) #6 /home/ministryofcraft/public_html/core/model/modx/modparser.class.php(537): m in /home/ministryofcraft/public_html/core/components/formit/model/formit/fivalidator.class.php on line 34

Try the fix I commented in that issue to generate an optimized autoloader. Run this command in core/components/formit/:

composer install --prefer-dist --no-dev --no-progress --optimize-autoloader

Thanks Mark. I ran it locally and then zipped up the formit folder and uploaded and unpacked. Works again now. Thanks

composer install --prefer-dist --no-dev --no-progress --optimize-autoloader
1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.