We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13629
    • 23 Posts
    Select field validation doesn’t seem to work with eForms.

    According to the docs, I can have something like this:


    1. Selectbox - set as required field (no validation required) <select name="mySelect" eform="Select Country::1" /> (datatype left blank) <option value="en-au">Australia</option> <option value="en-us">USA</option> </select>

    (By the way, "<select />" is not valid XHTML. It should be "<select>". Mistakes like this make me trust the docs less.)

    Here’s what I’m trying:
    <select name="country" id="country" eform="Select Country::1">
      <option value="">please choose...</option>
      <?php
      foreach($countries as $country)
      {
        ?><option value="<?php echo $country->iso ?>"><?php echo $country->printable_name ?></option><?php
      }
      ?>
    </select>
    


    MODx version: 0.9.6.1p2
    eForm version: 1.4.2

    What am I doing wrong?

    Also, in the docs’ example, how could validation ever fail? There are two options, Australia and USA, and one of them will always be selected by default. As far as I can tell, there would be no way to test that example.

    Thanks,
    Jason