There are a bunch of date/time picker widgets out there that format
the data for you before sending to the server. Maybe that would be
simpler.

On Fri, Dec 5, 2008 at 6:03 AM, laeffe <[EMAIL PROTECTED]> wrote:
>
> Hi all.
> I have a problem that I don't really know how to solve.
>
> The actual problem is that I want to parse the way ppl enter time in
> forms, for instance i want "0600" to be 06:00:00 and 0234 to be
> 02:34:00 (and of course I want 07:00:00 to be valid as well). That is
> the basic problem.
>
> My solution for this was to create a behavior that I called humantime,
> which would parse the data before validation and convert 0600 to
> 06:00:00 so that validation could parse it and MySql would be happy.
> This solution works perfectly, accept for a little "glitch", in some
> places I want to use the humantime version (of the data) in my
> controller, because I like to do some comparison before saving the
> data. I would also like to send the converted data back to the view so
> that the user can see what he's time got converted to without having
> to redirect the user to a page that will re-read the data.
>
> The reason that it doesn't work at the moment (according to me) is
> because the behavior gets a copy of the data array and not the actual
> data.
>
> But anyhow since I want to do this before the controller starts
> working maybe a component of some sort would be a better idea?
>
> Any suggestions (or questions :P)?
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to