mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-03 09:43:33 +02:00
Biz logic for hiding urbanization
This commit is contained in:
parent
502f6b9444
commit
21306531d9
3 changed files with 38 additions and 3 deletions
|
@ -657,6 +657,37 @@ function hideDeletedForms() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Checks for if we want to display Urbanization or not
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
var stateTerritoryField = document.querySelector('select[name="organization_contact-state_territory"]');
|
||||||
|
|
||||||
|
if (!stateTerritoryField) {
|
||||||
|
// console.log("State territory field not found, skipping urbanization setup.");
|
||||||
|
return; // Exit if the field is not found
|
||||||
|
}
|
||||||
|
|
||||||
|
setupUrbanizationToggle(stateTerritoryField);
|
||||||
|
});
|
||||||
|
|
||||||
|
function setupUrbanizationToggle(stateTerritoryField) {
|
||||||
|
var urbanizationField = document.getElementById('urbanization-field');
|
||||||
|
|
||||||
|
function toggleUrbanizationField() {
|
||||||
|
// console.log("Selected value:", stateTerritoryField.value);
|
||||||
|
if (stateTerritoryField.value === 'PR') { // For Puerto Rico
|
||||||
|
urbanizationField.style.display = 'block';
|
||||||
|
} else {
|
||||||
|
urbanizationField.style.display = 'none';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initial check
|
||||||
|
toggleUrbanizationField();
|
||||||
|
|
||||||
|
// Add event listener for changes
|
||||||
|
stateTerritoryField.addEventListener('change', toggleUrbanizationField);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An IIFE that attaches a click handler for our dynamic formsets
|
* An IIFE that attaches a click handler for our dynamic formsets
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends 'domain_request_form.html' %}
|
{% extends 'domain_request_form.html' %}
|
||||||
{% load field_helpers url_helpers %}
|
{% load field_helpers url_helpers static %}
|
||||||
|
|
||||||
{% block form_instructions %}
|
{% block form_instructions %}
|
||||||
<p>If your domain request is approved, the name of your organization and your city/state will be listed in <a href="{% public_site_url 'about/data/' %}" target="_blank">.gov’s public data.</a></p>
|
<p>If your domain request is approved, the name of your organization and your city/state will be listed in <a href="{% public_site_url 'about/data/' %}" target="_blank">.gov’s public data.</a></p>
|
||||||
|
@ -37,7 +37,12 @@
|
||||||
{% input_with_errors forms.0.zipcode %}
|
{% input_with_errors forms.0.zipcode %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
|
|
||||||
{% input_with_errors forms.0.urbanization %}
|
<div id="urbanization-field" style="display: none;">
|
||||||
|
{% input_with_errors forms.0.urbanization %}
|
||||||
|
</div>
|
||||||
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
<script src="{% static 'js/get-gov.js' %}" defer></script>
|
||||||
|
|
||||||
|
|
|
@ -534,7 +534,6 @@ class OrganizationContact(DomainRequestWizard):
|
||||||
template_name = "domain_request_org_contact.html"
|
template_name = "domain_request_org_contact.html"
|
||||||
forms = [forms.OrganizationContactForm]
|
forms = [forms.OrganizationContactForm]
|
||||||
|
|
||||||
|
|
||||||
class AboutYourOrganization(DomainRequestWizard):
|
class AboutYourOrganization(DomainRequestWizard):
|
||||||
template_name = "domain_request_about_your_organization.html"
|
template_name = "domain_request_about_your_organization.html"
|
||||||
forms = [forms.AboutYourOrganizationForm]
|
forms = [forms.AboutYourOrganizationForm]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue