We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    Henrik, Are you also on MODX cloud? Have you tried some even larger numbers in sleep() like 5 or 10, just to see if they work?

    FWIW, the FormIt and FormIt Retriever system seems unnecessarily complex to me. I'd be inclined to use a custom snippet that saved the data in a $_SESSION variable and set placeholders for the form fields, but maybe I'm missing something, and of course that's not an option for a lot of people.
      Did I help you? Buy me a beer
      Get my Book: MODX:The Official Guide
      MODX info for everyone: http://bobsguides.com/modx.html
      My MODX Extras
      Bob's Guides is now hosted at A2 MODX Hosting
      • 12028
      • 152 Posts
      Hi Bob,

      The website is not on the MODX Cloud.

      I have not tried the 5 or 10 seconds because of the usability issues. But I can try later when I have access to the files. (Summertime/holiday...)

      At the moment I'm running MODX version 2.5 and FormIt version 2.2.10 on PHP Version 5.5.37, CGI/FastCGI running under Redhat. And all cache, varnish, CDN's etc. are disabled.

      If you want more information, please let me know.

      (I agree with you in that FormIt and FormItRetriever is too complex!)

      And many thanks for your effort, not only for this! [ed. note: Henrik Nielsen last edited this post 7 years, 9 months ago.]
        - A small step for mankind, so why not take two...

        Working with web production, graphic design/workflow, photo and education - but are trying to get a life in between!
        • 22197
        • 40 Posts
        Yes, this solution works. Also for me. But, I'm afraid that a future update of formit will destroy my addition - and quite probably by then I will have forgotten about it.

        I've got two questions:


        1. Will the problem be solved when I use a more powerful server?
        2. How to make update-proof adaptations in the code?

        Regards

        Ludo


        Quote from: BobRay at Jul 16, 2016, 03:43 PM
        You could try this to see if it's a timing problem. The cache file may not be written fast enough to be there when FormIt retriever tries to get it (though that seems unlikely).

        In the file: core\components\formit\model\formit\fidictionary.class.php

        around line 138, find this code:

         public function retrieve() {
                $cacheKey = $this->formit->getStoreKey();
                return $this->modx->cacheManager->get($cacheKey);
         }
        

        Change it to:

         public function retrieve() {
                sleep(3);  /* add this line */
                $cacheKey = $this->formit->getStoreKey();
                $modx->log(modX::LOG_LEVEL_ERROR, 'FormIt CacheKey: ' . $cacheKey); /* And this line */
                return $this->modx->cacheManager->get($cacheKey);
         }
        


        The second added line is so you can look in the Error Log and see if the key stays the same (it should).

        If that solves it, try sleep(1). If it doesn't solve the problem, remove the extra lines. If it does, just remove the error log line.
          • 3749
          • 24,544 Posts
          I'm not sure about your first question, but I don't think there's much chance that a FormIt upgrade will cause trouble for you.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 22197
            • 40 Posts
            Thank you.
            From a user perspective the delay (sleep 3) is very annoying.
            Is there a trick to make the server respond immediately and do the "sleeping" while preparing the output of the next page (possibly showing some moving gif).

            Quote from: BobRay at Oct 11, 2018, 10:50 PM
            I'm not sure about your first question, but I don't think there's much chance that a FormIt upgrade will cause trouble for you.