So I have my controller action similar to this
$task1 = new Task();
$form1 = $this->createForm(new MyForm(), $task1);
$task2 = new Task();
$form2 = $this
// your form type
class myType extends AbstractType
{
private $name = 'default_name';
...
//builder and so on
...
public function getName(){
return $this->name;
}
public function setName($name){
$this->name = $name;
}
// or alternativ you can set it via constructor (warning this is only a guess)
public function __constructor($formname)
{
$this->name = $formname;
parent::__construct();
}
}
// you controller
$entity = new Entity();
$request = $this->getRequest();
$formType = new myType();
$formType->setName('foobar');
// or new myType('foobar'); if you set it in the constructor
$form = $this->createForm($formtype, $entity);
now you should be able to set a different id for each instance of the form you crate.. this should result in