We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37523
    • 141 Posts
    I am not sure weather this is a bug or not but I am getting:
    Warning; in_array() expects parameter 2 to be array, string given in /path/to/core/cache/exconfig/includes/elements/modsnippet

    on a select field within Formit.

    I am using MODX Revolution 2.2.6-pl (advanced) with Formit 2.2.0

    My select field looks like:
    <label>Firm type <span class="red">*</span>
    		<span class="error">[[+fi.error.firmtype]]</span>
    		<select name="firmtype" value="[[!+fi.firmtype]]">
    		  <option value="">PLEASE SELECT</option>
    		   <option value="endowment" [[!+fi.firmtype:FormItIsSelected=`endowment`]]>Endowment</option>
    		   <option value="familyoffice" [[!+fi.firmtype:FormItIsSelected=`familyoffice`]]>Family Office</option>
    		   <option value="fundOfFunds" [[!+fi.firmtype:FormItIsSelected=`fundOfFunds`]]>Fund of Funds</option>
    		   <option value="highNetWealth" [[!+fi.firmtype:FormItIsSelected=`highNetWealth`]]>High Net Wealth</option>
    		   <option value="institution" [[!+fi.firmtype:FormItIsSelected=`institution`]]>Institution</option>
    		   <option value="pensionFund" [[!+fi.firmtype:FormItIsSelected=`pensionFund`]]>Pension Fund</option>
    		   <option value="sovereignWealth" [[!+fi.firmtype:FormItIsSelected=`sovereignWealth`]]>Sovereign Wealth</option>
    		  </select>
    	  </label>


    I cleared my cache both by running from within MODX and deleting the core/cache files but to no avail.

    Does anybody have any advice or am I going to have to find another solution.

    This question has been answered by glynszasz. See the first response.

    [ed. note: glynszasz last edited this post 13 years, 1 month ago.]
      Glyn Szasz
      Sydney, Australia

      Happy to help (when can) and happy to learn

      If you are a Sydney based MODX developer would love to hear from you. Please contact me.
    • discuss.answer
      • 37523
      • 141 Posts
      I solved the above issue by changing the way that each option is written. So instead of:
      <option value="endowment" [[!+fi.firmtype:FormItIsSelected=`endowment`]]>Endowment</option>

      I use:
      <option value="endowment" [[!+fi.firmtype:is=`endowment:then=`selected`]]>Endowment</option>

      This method is described as an alternative on the FormIt.Handling Selects, Checkboxes and Radios page.
      Hope this help someone
        Glyn Szasz
        Sydney, Australia

        Happy to help (when can) and happy to learn

        If you are a Sydney based MODX developer would love to hear from you. Please contact me.
        • 19872
        • 1,078 Posts
        THANK YOU!!!!
        I have been struggling with this since early this morning. This solved the issue for me.

        NOTE:
        I believe you need the back tic after endowment just before the colon.

        <option value="endowment" [[!+fi.firmtype:is=`endowment[b]`[/b]:then=`selected`]]>Endowment</option>
          • 36582
          • 463 Posts
            Web site design in Nottingham UK by Chris Fickling http://www.chrisficklingdesign.co.uk
            • 3186 ☆ A M B ☆
            • 279 Posts
            Should have been fixed a long time ago

            https://github.com/splittingred/FormIt/pull/90
              MODX Ambassador (NL) & Professional MODX developer
              Follow me on Twitter | Visit my page on Facebook | View my code on Github | View my script posts
              MODX e-commerce solution SimpleCart