Forum: Ruby on Rails validation date

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.
Fcb55a782937626dec6e02a311075b74?d=identicon&s=25 Walde Man (alabama)
on 2007-05-22 13:44
Hi everybody !
I can't find validation for date.
In my form I use form.date_select.
How I can protect this field from selection for egzample "month->
February, day -> 30".
ActiveRecord don't save it, but error will raise. I would like to serve
this error in this same way as other kind of validation.
Similar problem is when we have
form.date_select :date_attribute, {:include_blank => true}.
Then strange date save possibly, when not all three parts was selected,
for egzample only month but not year and day. Always first part is as
year and missing data are filled with 1.
How I can via validation indicate my user which part of date he/she has
forgetten fill.
Theoretically we have validates_format_of with option :with, but I
couldn't find it as useful in this case. Maybe I'm wrong.
What kind of strategy I should choice?
42d4590355a1404230fbc9aff4dd377b?d=identicon&s=25 Myron Marston (Guest)
on 2007-05-22 15:59
(Received via mailing list)
I use the calendar control from http://datetime.toolbocks.com/.  It
takes care of preventing invalid dates such as February 30th.


On May 22, 7:44 pm, Walde Man <rails-mailing-l...@andreas-s.net>
00e3a96684ab390a350b0271e98741d3?d=identicon&s=25 Nshbrown Nshbrown (nshb)
on 2007-05-23 06:54
(Received via mailing list)
If you check the TRUNK, you'll notice it will solve any RJS problems
you may have had with older versions causing errors. Also couple fixes
in there for Modal windows so it shows up on top.

Official release coming soon! :)

Nathaniel.

On 5/22/07, Myron Marston <myron.marston@gmail.com> wrote:
> > How I can protect this field from selection for egzample "month->
> > Theoretically we have validates_format_of with option :with, but I
> > couldn't find it as useful in this case. Maybe I'm wrong.
> > What kind of strategy I should choice?
> >
> > --
> > Posted viahttp://www.ruby-forum.com/.
>
>
> >
>


--
Nathaniel Steven Henry Brown

Toll Free: 1-877-446-4647
Vancouver: 604-724-6624
This topic is locked and can not be replied to.