We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32046
    • 75 Posts
    I have a huge select list (multiple selection) of about 2000 items. I know, it's too big, but that's the way the client want it...

    Anyway, the eForm works nicely if I have less than 1339 items, after that it crashes out at line 968 (eform debug is on) when it tries to validate. I wonder if it is a memory issue?

    eform line 968 (ish)
    if( $isDebug && count($vlist)==1 && empty($vlist[0])  ){
    					 //if debugging bail out big time
    					 $modx->messageQuit('Error in validating form field!', '',$false,E_USER_WARNING,__FILE__,'','#LIST rule declared but no list values supplied: '.$fld[5],__LINE__);


    The error message is "#LIST rule declared but no list values supplied"

    <select name="productMachineCategories[]" multiple="multiple" size="3" eform="::0" />
          [+machineCategorySelectOptions+]
       </select>


    I'm populating the form via a function using eformOnBeforeFormParse as suggested by TobyL in http://forums.modx.com/index.php?topic=32161.0. The options are all valid.

    Example option is
    <option value="459">Agricultural > John Deere > Tractor > 3140</option>


    eForm is latest 1.4.4.7. Note, if I turn off eForms debug (&debug=`0`) then it does not crash out, but does not retain the selected values in the select list.

    Any ideas anyone?
    • Could well be a memory issue.

      That list should be broken into three separate select boxes with each box populated by its own list and child selects enabled as an item is selected in its parent box; AJAX is optional but would reduce the final load even more. The submit button could even be disabled until valid selections are made.

      http://www.appelsiini.net/2010/jquery-chained-selects

      Another option is a scrolling box of radio buttons or check boxes. I tend to prefer this over select drop-downs anyway.

      http://c82.net/posts.php?id=25
      http://c82.net/samples/checklist-samples.html

      to make it behave in a single-select way

      http://danmrichards.wordpress.com/2010/12/22/limit-checkbox-selection-with-jquery/



      [ed. note: sottwell last edited this post 12 years ago.]
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 32046
        • 75 Posts
        Yeah, thanks Sottwell. The box can't really be broken easily into separate select boxes - that's what I would usually do with AJAX loading each box progressively - one for category, one for brand, one for type and one for model. But as its a multiple-select box and the category and subcategory etc may be different for each selection (possible dozens of selections) it does not work well. My next move was to be checkboxes with expanding categories (something like you suggest), but would this be any different on memory than a huge select box? Can I extend the memory available with something like
        ini_set('memory_limit', '512M');

        • Well, you can try that. I'd also consider the PHP time limit as well.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 32046
            • 75 Posts
            For those interested it turned out to be a php setting was too low for so much data and the preg_match around line 965 of eform.inc.php was returning an empty array instead of an array of acceptable select values. Anyway, I added the following code to the start of eform.inc.php and the problem is solved.
            ini_set("pcre.backtrack_limit", "200000");
            ini_set("pcre.recursion_limit", "200000");

            These values were 100000 by default. What exactly they do I'm not 100% sure, that's my next session of googling. I know it sucks to have such big select boxes but hey, the customer is always right aye wink