Hello,
generally: I was looking for enum too for use types. You can use Has
One relationships to extend users by types as well. (User HasOne
Admin, User HasOne SuperUser, User HasOne Customer, User HasOne
Client) Besides that, if you can/want to work with a boolean switch
(is_admin TINYINT 1
Cake has no official support for ENUM. (there may be ways to use them,
of course)
The simplest way to deal with this would be to change your column to
(mysql version):
active BOOLEAN DEFAULT FALSE (or TRUE, whichever you want)
or
active BIT(1) DEFAULT 0 (or 1)
or
active TINYINT(1) DEFAULT 0 (or
Ok Brian so i ll use tinyint.But after that i make default 1 for
active and when i wanr to change it to inactive nothing happen.I am
using a checkbox coz i think it's the most appropriate for my
needs.Can you help me if i am wrong?Here is my code:
view
?php
echo $form-create('User',
That looks ok, I think. Did you try that?
One thing I noticed is that your form won't have $id in the action, so
$this-User-id = $id; won't always work the way you expect. I usually
do something along these lines:
function change_status($id=null)
{
if (empty($this-data))
{
I still have problem.And i can't figure out what cause it!I used a checkbox
and still nothing.
view/change_status
?php
echo $form-create('User', array('action' = 'change_status'));
echo $form-input('User.status', array ('type' = 'checkbox','label'=
It's usually best to state exactly what problems one is encountering.
That being said, for a single checkbox, I usually use this format:
?php echo $form-hidden('User.id'); ?
labelActive
?php echo $form-checkbox(’User.status’); ?
/label
The way you were doing it is more like what one would use
Yes you are right.Sorry for not being more accurate.The problem i am facing
is that when i select a choice check/uncheck the checkbox the controller
function dont do anything.In other words the new data in user status cant
replace the older.And i cant find if it is problem in form or in