Ariyan
Ariyan

Reputation: 15168

Logic exception when using formfield in symfony

I'm trying to use this DatePicker form type in my Twig form:
https://github.com/mohebifar/DateTimeBundle
Using jquery widget as described here:
https://github.com/mohebifar/DateTimeBundle/blob/master/Resources/doc/2.3-date-picker-form-type.md

Like this:

{% block headassets %}
    {% stylesheets 'bundles/itwuser/css/*.css' filter='cssrewrite' %}
        <link rel="stylesheet" href="{{ asset_url }}" />
    {% endstylesheets %}

    {{ form_datetime_css(form) }}
    {{ form_datetime_js_asset(form) }}
    {{ form_datetime_js(form) }}
{% endblock %} 

But I'm getting this LogicException at the line form_datetime_css(form)

LogicException: Unable to render the form as none of the following blocks exist: "_itw_userbundle_user_css", "itw_userbundle_user_css", "form_css".

What is the problem?


Update:
I added the theme:

{% form_theme form 'MohebifarDateTimeBundle::form_fields.html.twig' %}

But still same exception occurs!

Upvotes: 0

Views: 420

Answers (1)

Jovan Perovic
Jovan Perovic

Reputation: 20201

This seems to me like missing form theme. I would assume that this bundle came with written theme which extends the basic but also adds the those blocks.

If you're unfamiliar with form themes please see this link: http://symfony.com/doc/current/cookbook/form/form_customization.html#method-2-inside-a-separate-template

Upvotes: 1

Related Questions