On 26 Jul., 06:34, Bart <bart.hardi...@gmail.com> wrote:
> I have an tinyint(1) field in most of my tables named active default
> value is set to null. By default I want the value of this field to be
> 1. However, I cannot get the automagic checkbox to be checked in the
> form. I cannot get the value to prime to 1. Seems simple enough but i
> am still stuck.
>
> I have tried setting the default value in the add.ctp.
>
> echo $form->input('active', array( 'default' => '1'));
> echo $form->input('active', array( 'default' => 1));
> echo $form->input('active', array( 'default' => true));
> echo $form->input('active', array( 'default' => 'true'));
>
> None of these worked. Was not sure of the syntax so I tried everything
> but the sink.
>
> I tried adding a line to the file_controller.php in the add function.
>
> $this->data['file']['active'] = 1;
>
> I could not get it to work this way either. Not sure exactly where in
> the add function the form is actually called or if I am in the right
> direction. So I tried it in several places.
>
> I have also tried changing the default value in the mysql table. Still
> not getting it.
>
> I really think this should be simple but I am floundering. I know I am
> making it too hard. Please point me in the right direction.
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
Sunday, July 26, 2009
Re: Automatically Check a Checkbox
$this->data['MODELNAME']['active'] = 1;
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment