Forum: Ruby on Rails date validations

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
22785d4dbf585723bf60458ece0170e1?d=identicon&s=25 jjathman@gmail.com (Guest)
on 2007-01-07 22:39
(Received via mailing list)
I have two parts of a question.  First I have several dates in my app
which aren't required, so I don't think I can use a date_select right?
There doesn't seem to be a way to give the user an option to *not*
select a date.

So, assuming I need to just give the users a form field, anyone have a
good piece of code for checking the validity of a date, allowing
various forms, i.e.:
12.12.2007
12/12/2007
12-12-2007

Any suggestions?

Thanks, Joe.
72f8ab180f81f9c544e2b58da399c0be?d=identicon&s=25 Elad Meidar (eizesus)
on 2007-01-07 22:43
jjathman@gmail.com wrote:
> I have two parts of a question.  First I have several dates in my app
> which aren't required, so I don't think I can use a date_select right?
> There doesn't seem to be a way to give the user an option to *not*
> select a date.
>
> So, assuming I need to just give the users a form field, anyone have a
> good piece of code for checking the validity of a date, allowing
> various forms, i.e.:
> 12.12.2007
> 12/12/2007
> 12-12-2007
>
> Any suggestions?
>
> Thanks, Joe.

No No No :)

use some javascript to enable or to disable that date select with a
check box for example, and then use the check box value in the
controller in order to check if to use the date select value or not.
3a0257019a40dbaf6cbda0cc780c1720?d=identicon&s=25 paul (Guest)
on 2007-01-07 23:22
jjathman@gmail.com wrote:
> I have two parts of a question.  First I have several dates in my app
> which aren't required, so I don't think I can use a date_select right?
> There doesn't seem to be a way to give the user an option to *not*
> select a date.
>
> So, assuming I need to just give the users a form field, anyone have a
> good piece of code for checking the validity of a date, allowing
> various forms, i.e.:
> 12.12.2007
> 12/12/2007
> 12-12-2007
>
> Any suggestions?
>
> Thanks, Joe.

try this plugin for validation
http://svn.viney.net.nz/things/rails/plugins/valid...
This topic is locked and can not be replied to.