niedziela, 28 listopada 2010

Symfony form modification problem

After Symfony form customization you'll probably get an error like this:

Warning: array_key_exists() [function.array-key-exists]: The first argument should be either a string or an integer in lib/vendor/symfony/lib/util/sfParameterHolder.class.php on line 53

the fix is to specify widget's name format

$this->widgetSchema->setNameFormat("XYZ[%s]");

So you'll get something like

class AgendaUserForm extends BaseAgendaUserForm
{
public function configure(){

$this->setWidgets(array(
'email' => new sfWidgetFormInput(),
'pass' => new sfWidgetFormInputPassword()
));

$this->setValidators(array(
'email' => new sfValidatorEmail(),
'pass' => new sfValidatorString(array('max_length' => 255)),
'id' => new sfValidatorPass()
));

$this->widgetSchema->setNameFormat("ABC[%s]");
}
}

Brak komentarzy:

Prześlij komentarz