This works for me in latest 1.2.
However, maybe this logic should be in your view??
echo $form->input('anotherfield', array('default' => 'A default
value'));
Cheers,
Adam
On Feb 15, 12:03 pm, duncan_m <[EMAIL PROTECTED]> wrote:
> Hi there,
>
> I guess I'm just not understanding fundamental...
>
> I have a simple controller with Baked methods for adding, editing
> etc.. I'm trying to modify the behaviour, when the add() method is
> invoked I want to populate a few default values for a couple of the
> fields.. My code currently looks like this:
>
> function add($resSomeIntegerValue) {
> if (empty($this->data)) {
> $this->data['Expense']['SomeField'] =
> $resSomeIntegerValue;
> $this->data['Expense']['AnotherField'] = 'A Default
> Value';
> $this->render();
>
> As you can see I've added two lines to set up 2 fields with the values
> I want as a default when calling this method. The view, when it
> renders, doesn't have these default values displayed..
>
> Any help much appreciated.
>
> With thanks,
>
> Duncan.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---