saving date and validation

helo… im new in yii framework…

so i would like to ask some question about saving date…

and validation… can u plz give some example of the code…

thx…

If you'd like to store 'creation date' or something like that of the record, you may refer the blog demo that has following database schema and a corresponding code.

Quote

CREATE TABLE Post

(

        id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,

        title VARCHAR(128) NOT NULL,

        content TEXT NOT NULL,

        contentDisplay TEXT,

        tags TEXT,

        status INTEGER NOT NULL,

        createTime INTEGER,

        updateTime INTEGER,

        commentCount INTEGER DEFAULT 0,

        authorId INTEGER NOT NULL,

        CONSTRAINT FK_post_author FOREIGN KEY (authorId)

                REFERENCES User (id) ON DELETE CASCADE ON UPDATE RESTRICT

);

Quote

If you'd like to store 'creation date' or something like that of the record, you may refer the blog demo that has following database schema and a corresponding code.

Quote

CREATE TABLE Post

(

        id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,

        title VARCHAR(128) NOT NULL,

        content TEXT NOT NULL,

        contentDisplay TEXT,

        tags TEXT,

        status INTEGER NOT NULL,

        createTime INTEGER,

        updateTime INTEGER,

        commentCount INTEGER DEFAULT 0,

        authorId INTEGER NOT NULL,

        CONSTRAINT FK_post_author FOREIGN KEY (authorId)

                REFERENCES User (id) ON DELETE CASCADE ON UPDATE RESTRICT

);

im not refering to blog demo…

i want to save for example birthdate…

and if some add ons or chtml by yii ready to use "calendar"…

thx for the rply…  :D

Quote

Quote

If you'd like to store 'creation date' or something like that of the record, you may refer the blog demo that has following database schema and a corresponding code.

Quote

CREATE TABLE Post

(

        id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,

        title VARCHAR(128) NOT NULL,

        content TEXT NOT NULL,

        contentDisplay TEXT,

        tags TEXT,

        status INTEGER NOT NULL,

        createTime INTEGER,

        updateTime INTEGER,

        commentCount INTEGER DEFAULT 0,

        authorId INTEGER NOT NULL,

        CONSTRAINT FK_post_author FOREIGN KEY (authorId)

                REFERENCES User (id) ON DELETE CASCADE ON UPDATE RESTRICT

);

im not refering to blog demo…

i want to save for example birthdate…

and if some add ons or chtml by yii ready to use "calendar"…

thx for the rply…  :D

help… plz… anyone???

your database birthday column is a date field.

In your view use a CMaskTextfield (eg 99.99.9999)

in your model validate and transform it to the correct format

Quote

your database birthday column is a date field.

In your view use a CMaskTextfield (eg 99.99.9999)

in your model validate and transform it to the correct format

i try to use CMaskedTextField but when i try to save it my textfield is null…

validator generate this error bday is required…

am i missing something??

here is my code in my view page:

$this->widget('CMaskedTextField',array(

    'mask'=>'9999-99-99',

'model'=>$model,


'attribute'=>'bday',


'name'=>'bday' 

));

Quote

Quote

your database birthday column is a date field.

In your view use a CMaskTextfield (eg 99.99.9999)

in your model validate and transform it to the correct format

i try to use CMaskedTextField but when i try to save it my textfield is null…

validator generate this error bday is required…

am i missing something??

here is my code in my view page:

$this->widget('CMaskedTextField',array(

    'mask'=>'9999-99-99',

'model'=>$model,





'attribute'=>'bday',





'name'=>'bday' 

));

help please… im planning to use this framework to my new project…

Quote

Quote

Quote

your database birthday column is a date field.

In your view use a CMaskTextfield (eg 99.99.9999)

in your model validate and transform it to the correct format

i try to use CMaskedTextField but when i try to save it my textfield is null…

validator generate this error bday is required…

am i missing something??

here is my code in my view page:

$this->widget('CMaskedTextField',array(

    'mask'=>'9999-99-99',

'model'=>$model,





'attribute'=>'bday',





'name'=>'bday' 

));

help please… im planning to use this framework to my new project…

anyone solve this problem?? can u help me plz…

Do not set both 'attribute' and 'name'. The latter will take precedence.

Quote

Do not set both 'attribute' and 'name'. The latter will take precedence.

thanks a lot…  ;)