// in modules/foo/actions/actions.class.php
// Define the form
$this->form = new ContactForm();
// Add an empty option to the list of choices of a 'choice' widget
$form->getWidget('language')->setOption('add_empty', 'Please choose a language');
// Add a 'gender' list of options widget
$form->setWidget('gender', new sfWidgetFormChoice(array('expanded' => true, 'choices' => array('m' => 'Male', 'f' => 'Female')), array('class' => 'gender_list')));
// Change the HTML attributes of the 'subject' widget
$form->getWidget('subject')->setAttribute('disabled', 'disabled');
// Remove the 'subject' field
unset($form['subject'])
// Note: You cannot remove just the widget. Removing a widget will also remove the related validators
// Change the 'min_length' error in the 'message' validator
$form->getValidator('message')->setMessage('min_length', 'Message too short');
// Make the 'name' field optional
$form->getValidator('name')->setOption('required', false);