Commit ab4d9e17 authored by Marc Ducobu's avatar Marc Ducobu
Browse files

add javascript to ensure that fields with '_other' are checked - close #349

parent 79ccfb18
......@@ -49,8 +49,7 @@
{{ form_label(child, '', {'label_attr': { 'class' : 'inline'} }) }}
</div>
{% endfor %}
{{ form_widget(form._choices) }}
{{ form_widget(form._other) }}
{{ form_widget(form._other, {'attr': {'class': 'input-text-other-value'} }) }}
{% endspaceless %}
{% endblock choice_with_other_widget %}
......
......@@ -157,6 +157,13 @@
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();
</script>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment