I have in schema.yml:
Quest:
columns:
yes_no: { type: boolean, notnull: true }
answer: { type: string(100), notnull: false }
and QuestForm
$this->widgetSchema['yes_no'] = new sfWidgetFormSelectRadio(array('choices' => array(1 => 'yes', 0 => 'no')));
In template default I would like to render only this widget on start, but if user checks “no”, then I would like to render widget answer also, with textbox and this must be required => true, not null.
What is the best way to make it?
Symfony-like, this is achieved with a PostValidator !
First, as @samura mentioned, hide and observe the answer widget via (e.g.) jQuery, then use a PostValidator.
Then implement your validator
You can find more here