Skip to content

Commit

Permalink
Se oculta el input de opciones cuando no es necesario en la creación …
Browse files Browse the repository at this point in the history
…de campo personalizado
  • Loading branch information
jogianotti committed Oct 6, 2020
1 parent f4d0aec commit 4b2be19
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 20 deletions.
17 changes: 17 additions & 0 deletions src/Celsius3/CoreBundle/Resources/public/js/forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -612,4 +612,21 @@ $(document).ready(function () {
minimumResultsForSearch: Infinity,
allowClear: true
});
});

$(document).ready(function () {
$('#custom_field_type').bind('change', function () {
var field_type = $('#custom_field_type').val().split("\\").pop();
var field_value = $('#custom_field_value');
var field_value_form_group = field_value.closest(".form-group");

if (field_type === 'ChoiceType') {
field_value_form_group.show();
} else {
field_value_form_group.hide();
field_value.val("");
}
});

$('#custom_field_type').trigger("change");
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,3 @@
<hr class="separator_hr">
{{ new('admin_customuserfield', form, 'Celsius3CoreBundle:AdminCustomField', true) }}
{% endblock %}

{% block javascripts %}
{{ parent() }}
<script>
$('#custom_user_field_value').parent().hide();
$('#custom_user_field_type').bind('change', function () {
/*
1 = select
*/
if ($('#custom_user_field_type').val() == '1') {
$('#custom_user_field_value').parent().show();
} else {
$('#custom_user_field_value').parent().hide();
$('#custom_user_field_value').val("");
}
});
</script>
{% endblock %}

0 comments on commit 4b2be19

Please sign in to comment.