Skip to content

Commit

Permalink
hide/show county field
Browse files Browse the repository at this point in the history
  • Loading branch information
SKairinos committed Nov 7, 2023
1 parent 516f7fe commit 2af2fc8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
11 changes: 11 additions & 0 deletions portal/static/portal/js/onboarding_school.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
$(document).ready(() => {
$('#form-row-county').hide();

$('#id_country').on('change', (event) => {
if (event.target.value == 'GB') {
$('#form-row-county').show();
} else {
$('#form-row-county').hide();
}
});
});
7 changes: 5 additions & 2 deletions portal/templates/portal/teach/onboarding_school.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ <h4>Create a school or club</h4>
{{ create_form.non_field_errors }}

{% for field in create_form %}
<div class="row form--row">
<div id="form-row-{{ field.name }}" class="row form--row">
<div class="form--row__input col-sm-6 col-xs-12">
<div class="input--icon">
{{ field }}
{% if not field == create_form.country %}
{% if not field == create_form.country and not field == create_form.county %}
<span class="iconify" data-icon="mdi:domain"></span>
{% endif %}
</div>
Expand All @@ -60,4 +60,7 @@ <h4>Create a school or club</h4>
</div>
{% endif %}

<script type="text/javascript"
src="{% static 'portal/js/onboarding_school.js' %}"></script>

{% endblock content %}

0 comments on commit 2af2fc8

Please sign in to comment.