{% extends 'FenrizbesFormConstructorBundle:Form:base_validation_generator.html.twig' %}

{% block validation_generator %}
{% spaceless %}
<script>
    var {{ fc_form.alias }}FCValidation = new FCValidationClass('{{ fc_form.alias }}');

    {% for fc_field in fc_form.fieldsRecursively %}
        {% for fc_constraint in fc_field.constraints %}
            {{ fc_form.alias }}FCValidation.addConstraint({{ {
                type:    fc_constraint.constraint,
                field:   fc_field.name,
                message: fc_constraint.message,
                params:  fc_constraint.params,
                active:  true
            } | json_encode | raw }});
        {% endfor %}
    {% endfor %}
</script>
{% endspaceless %}
{% endblock %}
{% extends 'FenrizbesFormConstructorBundle:Form:base_validation_generator.html.twig' %}

{% block validation_generator %}
{% spaceless %}
<script>
    $(function(){
        var {{ fc_form.alias }}FCValidation = new FCValidationClass('{{ fc_form.alias }}');

        {% for fc_field in fc_form.fieldsRecursively %}
            {% for fc_constraint in fc_field.constraints %}
                {{ fc_form.alias }}FCValidation.addConstraint({{ {
                        type:    fc_constraint.constraint,
                        field:   fc_field.name,
                        message: fc_constraint.message,
                        params:  fc_constraint.params,
                        active:  true
                    } | json_encode | raw }});
            {% endfor %}
        {% endfor %}
    });
</script>
{% endspaceless %}
{% endblock %}
Declare validation after page load
Declare validation after page load
