Wanted to know if there is any way to create custom date validation? I want to be able to specify that if a date is selected from the date dialogue box, that it must be x days after "today's" date - today would be a relative date and not a fixed date.
Unfortunately there isn't an easy way to accomplish this. Here's the closest to an easiest way: 1. Create a field on your form and mark it as 'validate-date with calendar popup'. 2. Go to http://app.formassembly.com/forms/prefill_info/FORM_ID (where FORM_ID is the number of your form) 3. Record the id for the field you just created. 4. Paste this code into your custom code block (replacing tfa_FIELDID with the value from step 3, and DAYS with number of days in the future to limit by): <script> var elem = 'tfa_FIELDID'; //Do not change below this line base2.DOM.Element.addEventListener(document,'DOMContentLoaded',function(){ wFORMS.behaviors.validation.rules.isDateInTheFuture = { selector: "#"+elem, check: 'validateDateInTheFuture' } wFORMS.behaviors.validation.messages.isDateInTheFuture = "This date cannot more than DAYS in the future."; wFORMS.behaviors.validation.instance.prototype.validateDateInTheFuture = function(element, value) { var testDate = new Date(value); var today = new Date(); today.setDate(today.getDate()+DAYS) return (testDate.getTime() < today.getTime()); }; }); </script>
Is the procedure the same if I want it to be "can't be less than DAYS in the future"?
Also, can any of this be done on my basic subscription? I have the lowest level paid plan. Not sure if this is available in my subscription. Please let me know.