This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

GenemuBundle-Tinymce doesn't work, textarea remains textarea

Discuss Symfony 2 bundles here

GenemuBundle-Tinymce doesn't work, textarea remains textarea

by alexreddef » Mon Mar 23, 2015 2:12 pm

Hello,

I replace my message here since I got a message from forum's moderators. Thanks for having warned me. I guess now "Bundles Discussion" is the right place for my message.

PROBLEM

I am trying to make tinymce working but whatever I try my textarea remains a basic textarea.

POSSIBLE EXPLANATIONS

A compatibility problem between my JQuery library and Tinymce ?
A command that should be inserted within the form tag with array of attributes of the formbuilder to trigger Tinymce ? (I tried
Code: Select all
'required' => false
because I read it on a website but it actually doesn't make sense??? My field will in all cases be compulsory...)
A wrong coniguration in config.yml ?
Is it needed to be online because external resources are loaded ?

STEPS FOLLOWED AND CODE

I installed (i think) GenemuFormBundle for using Tinymce in my app (and other features if I manage to get it working). I followed instructions found on Guithub at https://github.com/genemu/GenemuFormBundle.

Everything worked properly. Composer downloaded files, I updated my kernel and placed some configurations lines in config.yml as follows :

Code: Select all
# Genemu Configuration
genemu_form:
    tinymce:
        enabled: true
        theme: modern


For the JS part everything is ok too : I inserted in myapp\Symfony\web\js\tinymce\js\tinymce\tinymce.min.js a
Code: Select all
alert("lalalala");
and when loading page on which I placed my form it pops it up fine showing that JS code is effectively inserted in the page.

Now what I have on my controller :
Code: Select all
//Création d'un objet
      $module = new Module();
      
      //Création d'un form pour test TinyMce
      $form = $this->createFormBuilder($module)
         ->add('nom', 'text')
         ->add('code', 'text')
         ->add('description', 'genemu_tinymce',  array('required' => false))
         ->getForm();
            
      return $this->render('ESPAdminBundle:Admin:v_adminAccueil.html.twig', array('info' => $repere, 'form' => $form->createView()));


And what I have on the twig view :
Code: Select all
{% extends '::main_view.html.twig' %}
   
   {% block stylesheets %}
      {{ parent() }}
      {{ form_stylesheet(form) }}
   {% endblock %}
   
   {% block scripts %}
      {{ parent() }}
      <script type="text/javascript" src="{{ asset('js/tinymce/js/tinymce/tinymce.min.js') }}"></script>
      {{ form_javascript(form) }}
   {% endblock %}
   
   {% block maindisplay %}
      {{ parent() }}
      
      {# Affichage de variables globales à des fins de test #}
      <p>Request={{ app.request }}</p>
      <p>User={{ app.user }}</p>
      {# Affichage de la route #}
      <strong>{{ info }}</strong>
      
      <form method="post">
         {{ form_widget(form) }}
         
         <input type="submit" />
      </form>
      
   {% endblock %}


And main_view.html.twig shows in JS block
Code: Select all
{% block javascript %}
   <script type="text/javascript" src="{{ asset('js/jquery-1.8.3.min.js') }}"></script>
   <script type="text/javascript" src="{{ asset('js/tinymce/js/tinymce/tinymce.min.js') }}"></script>
{% endblock %}


Well that's all. I cannot be more specific... Hope someone has a clue for me !

Thanks!

Alexandre from France, Sorèze
alexreddef
Junior Member
 
Posts: 1
Joined: Thu Mar 12, 2015 6:29 pm