public function render($name, $value = null, $attributes = array(), $errors = array())
 {
     if (false !== ($empty = $this->getOption('add_empty'))) {
         $label = true === $empty ? '' : $empty;
         $first_option = '<option value="">' . $label . '</option>';
     } else {
         $first_option = '';
     }
     return parent::render($name, $value, $attributes, $errors) . sprintf("\n<script type='text/javascript'>\n\$(function(){\n  \$('#%s').change(function(){\n    \$.getJSON('%s', { id: \$(this).val() }, function(data){\n      var options = '%s';\n      for (key in data) {\n        options += '<option value=\"' + key + '\">' + data[key] + '</option>';\n      }\n      \$('#%s').html(options);\n    })\n  })\n})\n</script>\n", $this->generateId($this->getOption('parent')), $this->getOption('url'), $first_option, $this->generateId($name));
 }
 /**
  * Constructor.
  *
  * @see sfWidgetFormDoctrineSelect
  */
 protected function configure($options = array(), $attributes = array())
 {
     parent::configure($options, $attributes);
     $this->setOption('multiple', true);
 }