I have an ad space website, where a person can place an advert, but for a maximum of 30 days.

To do this, I have a date field with a calendar popup and collect an end date on field. So it's one field collecting both dates. I need to validate the input of the end date by comparing it to the first field (start date). I have the field validation module installed, but I'm not sure how to configure it.

How do I configure it? Or is there a better way to do this?

1 Answer 1


The field validation module does what you want, the interface description can be confusing.

  1. On your Manage fields screen click the validate action link for your relevant date field.
  2. For your field you want to add a Date range2 validation rule.
  3. Name your rule in Rule name to a memorable description.
  4. For column select value2 to validate your end date.
  5. For Cycle of date select global so you can validate against time relative to the start date.
  6. For Maximum date set it to "+30 day" (or any strtotime() compatible relative string) so that the end date is, at most, 30 days from the start date.
  7. Set your your Custom error message.
  8. Click Save rule.
  • Thank you very much, that did the trick! Yeah, interface is a bit confusing. Thanks for your help. Sep 11, 2015 at 8:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.