We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26503
    • 620 Posts
    So, I have a form field that is not required, but must be a date format if it is entered...

    &validate=`title:required,
            description:required,
            venue:required,
            startdate:required:isDate=^%Y-%m-%d^,
            enddate:isDate=^%Y-%m-%d^`
    



    Problem is that it will never validate as putting a condition on the field seems to make it 'required'

    How do I do this?

      *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

      Sean Kimball CLP, CLS.
      Technical Director / Sr. Developer | BigBlock Studios
      ._______________________________________________.
      Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
      27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
      phone/fax: 905-426-5525
      • 3548
      • 102 Posts
      Create custom validator in which you can check if field is empty. If empty return true, if not, check if it is date format. If it is date format return success, otherwise $validator->addError($key,'Not big enough!');

      Custom validator is nothing but a snippet. Check here for more details
      http://rtfm.modx.com/display/ADDON/FormIt.Validators#FormIt.Validators-CustomValidators
        Antonio Zdilar
        linearvector.com