mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +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'} }) }}
|
||||
</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>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user