title: GenemuFormbundle select2 integration with Sonata Admin Bundle Symfony2.3
body: <p>I am trying to use select2 in my form.</p>
  
  <p>I installed GenemuFormBundle and added in the Kernal.Then I added few lines in config.yml</p>
  
  <pre><code>genemu_form:
      select2: ~
      date: ~
      autocomplete: ~
  </code></pre>
  
  <p>then i extend sonata admin standard layout twig</p>
  
  <pre><code>{% extends 'SonataAdminBundle::standard_layout.html.twig' %}
  {% block javascripts %}
      {{ parent() }}
  &lt;script src="{{ asset('bundles/admin/js/select2.js') }}" type="text/javascript"&gt; &lt;/script&gt;
   {% if form is defined %}{{ form_javascript(form) }}{% endif %} 
   {% endblock %}
   {% block stylesheets %}
    {{ parent() }}
  &lt;script src="{{ asset('bundles/admin/css/select2.css') }}" type="text/css"&gt;&lt;/script&gt;
    {% if form is defined %}{{ form_stylesheet(form) }}{% endif %}
   {% endblock %}
  </code></pre>
  
  <p>then i added few code in admin class</p>
  
  <pre><code>$formMapper
        -&gt;with('General')
        -&gt;add('category', 'genemu_jqueryselect2_entity', array('class' =&gt; 'AmanFrontendBundle:MtCat', 'property' =&gt; 'catName'))
  </code></pre>
  
  <p>After doing all this i got</p>
  
  <p><img src="https://i.stack.imgur.com/VHbGa.png" alt="enter image description here"></p>
  
  <p>AutoSuggest is not working and why i am getting a text box and drop down.</p>
  
  <p>javascript and css that  loaded on the page are</p>
  
  <p></p>
  
  <pre><code>        &lt;link rel="stylesheet" href="/aman/web/bundles/sonataadmin/bootstrap/css/bootstrap.min.css" type="text/css" media="all"  /&gt;
          &lt;link rel="stylesheet" href="/aman/web/bundles/sonataadmin/bootstrap/css/bootstrap-responsive.min.css" type="text/css" media="all" /&gt;
  
          &lt;!-- base application asset --&gt;
          &lt;link rel="stylesheet" href="/aman/web/bundles/sonataadmin/css/layout.css" type="text/css" media="all" /&gt;
          &lt;link rel="stylesheet" href="/aman/web/bundles/sonataadmin/css/colors.css" type="text/css" media="all" /&gt;
  
  &lt;script src="/aman/web/bundles/admin/css/select2.css" type="text/css"&gt;&lt;/script&gt;
  
  
          &lt;script src="/aman/web/bundles/sonatajquery/jquery-1.8.3.js" type="text/javascript"&gt;&lt;/script&gt;
          &lt;script src="/aman/web/bundles/sonatajquery/jquery-ui-1.8.23.js" type="text/javascript"&gt;&lt;/script&gt;
          &lt;script src="/aman/web/bundles/sonatajquery/jquery-ui-i18n.js" type="text/javascript"&gt;&lt;/script&gt;
  
          &lt;script src="/aman/web/bundles/sonataadmin/bootstrap/js/bootstrap.min.js" type="text/javascript"&gt;&lt;/script&gt;
  
          &lt;script src="/aman/web/bundles/sonataadmin/jquery/jquery.form.js" type="text/javascript"&gt;&lt;/script&gt;
          &lt;script src="/aman/web/bundles/sonataadmin/jquery/jquery.confirmExit.js" type="text/javascript"&gt;&lt;/script&gt;            &lt;script src="/aman/web/bundles/sonataadmin/base.js" type="text/javascript"&gt;&lt;/script&gt;
  </code></pre>
  
  
  
  <pre><code>    &lt;script type="text/javascript"&gt;
                jQuery(document).ready(function($) {
                  $field = $('#s5248479f910c0_category');
  
                    $field.select2({"placeholder":"Select a value","allowClear":false,"minimumInputLength":0,"width":"off"});
          });
  &lt;/script&gt;
  </code></pre>
  
  <p>And i also execute </p>
  
  <pre><code>sudo php app/console assets:install web/
  </code></pre>
  
  <p>Anything else i forget to add. Please help me out. </p>