We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10779
    • 22 Posts
    I can’t seem to validate this select box with eForm

    <select name="age" id="fAge" size="">
    <option></option>
    <option value="12-15">12-15</option>
    <option value="16-20">16-20</option>
    <option value="21-25">21-25</option>
    <option value="26-30">26-30</option>
    <option value="31-40">31-40</option>
    <option value="41-50">41-50</option>
    <option value="51-65">51-65</option>
    <option value="65+">65+</option>
    </select>

    Basically I want to make sure the first option isn’t selected,
    Anyone know the proper way to do this with eform?

    I tried eform="Age::1"
    and eform="Age::1::#LIST comma separated list of valid options"

    but to no avail.

    Any help would be greatly appreciated
      • 30223
      • 1,010 Posts
      I just copied and pasted your select into one of my existing form and it works as expected without any changes other than adding the eform attribute.
      <select name="age" id="fAge" size="" eform="Age::1">

      Not selecting anything will give a "required" error as it should.

      What version of eForm are you using? Perhaps post your complete form template and snippet call...
        • 10779
        • 22 Posts
        Ah ha..

        You’re right... it does work as expected.
        I stuck all of my select menus in chunks (because they are used in multiple forms),
        but the eform=’’ attribute seems to be ignored by the eform snippet when used used in a chunk.
        Do you know of a way around this?

        Thanks for looking into this for me, either way I know what the problem is.
          • 30223
          • 1,010 Posts
          It get’s ignored because the chunk is replaced by MODx after eForm is finished processing so all that eForm sees is "{{ChunkName}}" The easiest solution is to not use a chunk.. The other option is to create an event function for the eFormOnBeforeParse event and insert the chunk into the template in that function. Search around the forum for some examples...
            • 20413
            • 2,877 Posts
              @hawproductions | http://mrhaw.com/

              Infograph: MODX Advanced Install in 7 steps:
              http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

              Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
              http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower