We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2896
    • 70 Posts
    Hi,

    I’ve been searching the forums and I don’t find an answer for something simple (I think)

    How can the validation be set for a SELECT box with a number of options??
    What do I need to put in
    eform="SociaalEconStatuut::1::"

    so that the user must choose an option form the select box before submitting the mail?

    thx
      • 30223
      • 1,010 Posts
      You shouldn’t really need to do anything. As long as you are using valid xhtml markup select boxes should validate according to the option values. Ensure for instance that you use double quotes around attributes.

      <select name="selectbox" eform="Select Box::1">
          <option value="">None</option>
          <option value="1">Option 1</option>
          <option value="2">Option 2</option>
      </select>


      This should validate for "Option 1" and "Option 2" (values 1 and 2), but not for "None" (no value).
        • 33337
        • 3,975 Posts
        And if you use this:
        <select name="selectbox" eform="Select Box::1">
            <option value="[+selectbox:None+]">None</option>
            <option value="[+selectbox:Option 1+]">Option 1</option>
            <option value="[+selectbox:Option 2+]">Option 2</option>
        </select>
        

        Then the form will remember the selection too (between post backs?)

        regards.
          Zaigham R - MODX Professional | Skype | Email | Twitter

          Digging the interwebs for #MODX gems and bringing it to you. modx.link
          • 30223
          • 1,010 Posts
          It does that (remember) even when you’re not adding the placeholders... eForm adds these placeholders automatically. In fact it’s not so wise to add them yourself in the recent eForm versions as eForm will then have trouble extracting the values for it’s validation! (I think)

          And if you do add the placeholders you need to use the option values and not the option captions grin (that is if you want the values to be different from the captions off course)


            • 2896
            • 70 Posts
            It works OK now, I overlooked the empty value of the first option ... Knew this was somethig easy ;-)

            Thx guys for the help!
              • 33337
              • 3,975 Posts
              Quote from: TobyL at May 19, 2007, 01:27 AM

              It does that (remember) even when you’re not adding the placeholders... eForm adds these placeholders automatically. In fact it’s not so wise to add them yourself in the recent eForm versions as eForm will then have trouble extracting the values for it’s validation! (I think)

              And if you do add the placeholders you need to use the option values and not the option captions grin (that is if you want the values to be different from the captions off course)

              Hi TobyL, thanks for correcting me ... I think I was recalling old eForm stuff tongue ... need to update my brain’s wiki here laugh
                Zaigham R - MODX Professional | Skype | Email | Twitter

                Digging the interwebs for #MODX gems and bringing it to you. modx.link