Generated form (from Propel) expect an object as first argument.

Giving $defaults as an array in first parameter is with the basic sfForm
class.

You should extend your form and in the configure method change the default :

class myExemploForm extends ExemploForm
{
  public function configure()
  {
    parent::configure();
    $this->setDefault('email', 'Enter your e-mail here');
  }
}


You can use options to set a dynamic value ("email_help", for example).

Have fun,

Alex'

2009/11/25 Augusto Flavio <[email protected]>

> Hi,
>
>
>
> i'm trying to set defaults values dinamically for a form. Works using
> the configure method in my form class, ExemploForm but not from the
> action.
>
>
> i followed the steps of the symfony's manual:
>
> http://www.symfony-project.org/forms/1_2/en/01-Form-Creation#chapter_01_sub_defining_default_values_for_fields
> Listing 1-14
>
>
> public function executeMyAction($request)
> {
>  $this->form = new ExemploForm(array('email' => 'Your Email Here'));
>
>  // ...
> }
>
>
> But i'm getting an error:
>
> Catchable fatal error: Argument 1 passed to
> sfFormPropel::__construct() must be an instance of BaseObject, array
> given...
>
>
> Hwo can i fix it ?
>
>
> Thanks
>
>
>
> Augusto Morais
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "symfony users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<symfony-users%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en.
>
>
>


-- 
Alexandre Salomé -- [email protected]

--

You received this message because you are subscribed to the Google Groups 
"symfony users" 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/symfony-users?hl=en.


Reply via email to