mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +00:00
add javascript to ensure that fields with '_other' are checked - close #349
This commit is contained in:
parent
79ccfb184a
commit
ab4d9e174f
@ -49,8 +49,7 @@
|
|||||||
{{ form_label(child, '', {'label_attr': { 'class' : 'inline'} }) }}
|
{{ form_label(child, '', {'label_attr': { 'class' : 'inline'} }) }}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{{ form_widget(form._choices) }}
|
{{ form_widget(form._other, {'attr': {'class': 'input-text-other-value'} }) }}
|
||||||
{{ form_widget(form._other) }}
|
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
{% endblock choice_with_other_widget %}
|
{% endblock choice_with_other_widget %}
|
||||||
|
|
||||||
|
@ -157,6 +157,13 @@
|
|||||||
|
|
||||||
init_pikaday('{{ app.request.locale }}');
|
init_pikaday('{{ app.request.locale }}');
|
||||||
|
|
||||||
|
$('.input-text-other-value').each(function() {
|
||||||
|
$(this).change(function() {
|
||||||
|
checkbox = $(this).parent().find("input[type=checkbox][value=_other]")[0];
|
||||||
|
$(checkbox).prop('checked', ($(this).val() !== ""))
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
$('.select2').select2();
|
$('.select2').select2();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user