# Date Validation

**URL:** <https://www.ruby-forum.com/t/date-validation/112762>\
**Category:** Rails\
**Created:** [August 22, 2007, 11:39pm UTC](https://www.ruby-forum.com/t/date-validation/112762 "2007-08-22T23:39:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mschwab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/59ef9b/32.png) [@mschwab](https://www.ruby-forum.com/u/mschwab)\
**Post date:** [August 22, 2007, 11:39pm UTC](https://www.ruby-forum.com/t/date-validation/112762/1 "2007-08-22T23:39:08Z")

</div>

I am trying to validate a date field from within my model file but  
running into some issues. If I put invalid data in a textbox on a form,  
by the time it gets to my validate method, something has already emptied  
the data out because it does not meet the data type specs (date field).  
I could  
validate in the controller before I call a save, but then I can’t add to  
the errors collection and this doesn’t seem like the best practice  
either. Does anyone have any suggestions? I am not using drop down lists  
for the date fields, just a plain textbox which is needed for the  
business requiremnet. Thanks for any advice!
