Is "created"/"modified" a built-in thing for Cake?

Anyway, what I'm using the field for is not important.  This could be
a birthday field or something and the issue would persist.

My db schema for this field is:
    creationDate DATETIME NOT NULL

The Cake-baked default scaffold should have a modifiable Datetime in
my form, and it's not allowed to be empty.  In fact, the form doesn't
allow me to set the form to be empty if I tried.

But the Cake-baked default Controller keeps failing validation because
it says the field is empty.  Which is impossible.

If anyone needs more info from me to diagnose this problem, please let
me know.

-Grant


On Mar 19, 12:13 pm, brian <bally.z...@gmail.com> wrote:
> I'm not sure what the problem might be but, normally, you'd have a
> column called "created" and no form element(s). Cake will set the
> value itself. To do that your your table schema should have the
> following:
>
>     created DATETIME DEFAULT NULL,
>     modified DATETIME DEFAULT NULL
>
> I guess for something like logins, the modified column is unnecessary, though.
>
> On Thu, Mar 19, 2009 at 11:27 AM, GrantB <gr...@grantb.net> wrote:
>
> > I just created my first CakePHP app and I'm running into a snag.
>
> > I have a table "logins" with a datetime field.  I've baked the MVCs
> > with no outward signs of trouble.  In the scaffolded add view, my date
> > is a series of dropdowns with the current date/time preselected.
>
> > When I submit, Cake always gives me "This field cannot be left blank"
> > for this field.  It doesn't matter if I alter the preset values or
> > not.  Cake always thinks this is blank, and I'm not sure what to do
> > about it.
>
> > The validation array in the model is:
> >        var $validate = array(
> >                'username' => array('notempty'),
> >                'password' => array('notempty'),
> >                'creationDate' => array('date')
> >        );
>
> > The model and view involved here is completely 100% generated.  I have
> > not done any customization at all.
>
> > Any help would be greatly appreciated.  Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to