1

Well, I have this form:

class CaracteristicaForm extends sfForm {

    public function configure() {

        $this->setWidgets(array(
            'caracteristica' => new sfWidgetFormInputText(array('default'=>'hola mundo'))
        ));

        $this->setValidators(array(
            'caracteristica' => new sfValidatorString(
                array(
                    'max_length' => 150,
                    'required' => true
                )
            )
        ));

        $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    }

}

and then I try to...

$form = new CaracteristicaForm();
$this->embedForm('caracteristica', $form);

but the rendered inputText does not have any value at all.

What am I missing?

Ok, to reproduce this you need to embed this form into another form (mine is a Doctrine child form) so maybe is something about some method changing the value?

Well, passing an array defaults did the trick:

$form = new CaracteristicaForm(array('caracteristica' => $caracteristica));

1 Answer 1

1

Why not try to

$form->setDefault('caracteristica', $caracteristica);

in action?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.