We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4466
    • 14 Posts
    Hi all.
    How does one go about setting eform up that it will not submit before all the fields are filled in?
    I can’t find any documentation on this at all.

    Any help would be good smiley
    thanks all
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Each required field needs the "required" section of the eform pseudo-attribute set to 1.
      From the documentation that comes with eform:
      Datatypes and formatting

      eForm is incorporating a form parser which extracts formatting and validation options from each form field. To set options for a field add the eform(pseudo) attribute to each required form field.

      <input type="text" name="color" eform="A Color:string:1" />

      The basic format of the eform attribute is:

      [description/title]:[datatype]:[required]:[validation message]:[validation rule]
      And further on, some examples:
      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>

      2. Textbox - required and format set to date
      <input type="text" name="dobDate" eform="Date of Birth:date:1:@EVAL return (strtotime($value)!==-1)?true:false;" />

      3. Multiple checkbox - required, eform only set once.
      <input type="checkbox" name="myColors[]" value="Red" eform="Colors::1" /> (datatype left blank)
      <input type="checkbox" name="myColors[]" value="Green" /> (datatype left blank)
        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
        • 4466
        • 14 Posts
        you sir are a God that walks with men.

        thanks smiley i just wish that was better explaned in the reading info
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Yeah, I think it’s just one of those things that are presumed to be obvious, which of course it is - if you know about it! Like telling somebody how to drive a car "step on the gas to go, and the brake to stop". Um... what’s the "gas" and what’s the "brake", and this car has three pedals huh
            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