genemu / GenemuFormBundle

Extra Form : Captcha GD, Tinymce, Recaptcha, JQueryDate, JQueryAutocomplete, JQuerySlider, JQueryFile, JQueryImage
587 stars 263 forks source link

Unable to load css and javascript in twig template #279

Closed fredleput closed 11 years ago

fredleput commented 11 years ago

I try since a long time to load correctly css and js in my twig template but it never worked.

here's for example my css block : {% block stylesheets %} {{ parent() }}

<link href="{{ asset('css/uploadify/uploadify.css') }}" rel="stylesheet" />
<link href="{{ asset('css/jcrop/jquery.Jcrop.css') }}" rel="stylesheet" />
<link href="{{ asset('css/tokeninput/token-input-facebook.css') }}" rel="stylesheet" />
{{ form_stylesheet(form) }}

{% endblock %}

and here's the error i have :

An exception has been thrown during the rendering of a template ("Unable to render the form as none of the following blocks exist: "_fred_locationsbundle_locationtype_enregistrer_stylesheet", "submit_stylesheet", "button_stylesheet".") in FredLocationsBundle:Default:ajouterlocation.html.twig at line 11.

ghost commented 11 years ago

I also have the same bug. It seem related to form component in Symfony 2.3 with form button.

Here's my error :

"An exception has been thrown during the rendering of a template ("Unable to render the form as none of the following blocks exist: "_myform_submit_stylesheet", "submit_stylesheet", "button_stylesheet".") in "MyBundle:Default:new.html.twig"."

My form has this :

    $builder
        ->add('Submit', 'submit', array('attr' => array(
            'formnovalidate' => true,
            'class' => 'btn btn-primary btn-embossed'
        )))
    ;

If i comment this out, no problem anymore.

bamarni commented 11 years ago

it should be fixed if you upgrade to genemu form bundle 2.2.1