Skip to content

Commit

Permalink
follow legacy approach for address removal using state_id
Browse files Browse the repository at this point in the history
  • Loading branch information
charlienparker committed Jan 24, 2025
1 parent 9a64599 commit ab9b65b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 7 deletions.
6 changes: 2 additions & 4 deletions app/assets/javascripts/application.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -965,10 +965,8 @@ document.addEventListener('click', function(event) {
input.value = '';
});

// Clear select fields
el.querySelectorAll("select").forEach(select => {
select.value = '';
});
$(".mailing-div #state_id_mailing").val("")

el.classList.add('d-none');
el.classList.remove('d-block');
});
Expand Down
1 change: 0 additions & 1 deletion app/assets/javascripts/demographics_fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,6 @@ function demographicValidations() {
$('form.edit_person, form.new_dependent, form.edit_dependent').on(
'submit',
function (e) {
$('.mailing-div .stateInput').not(':visible').val('');
PersonValidations.validationForUsCitizenOrUsNational(e);
PersonValidations.validationForNaturalizedCitizen(e);
PersonValidations.validationForEligibleImmigrationStatuses(e);
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/_address_fields_for_dependent.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
</div>
<div class="col-sm col-md-6 pr-0">
<%= address.label :state, class: "required" %>
<%= address.select(:state, options_for_select(State::STATE_IDS, selected: address.object.try(:state)), {include_blank: "SELECT STATE"}, class:"w-100 stateInput required", required: true) %>
<%= address.select(:state, options_for_select(State::STATE_IDS, selected: address.object.try(:state)), {include_blank: "SELECT STATE"}, id: "state_id_#{kind}", class:"w-100 required", required: true) %>
</div>
</div>
<div class="d-flex col-sm col-md-6 pr-0">
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/_consumer_home_address_fields.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
</div>
<div class="col-sm col-md-6 pr-0">
<%= address.label :state, class: "required" %>
<%= address.select(:state, options_for_select(State::STATE_IDS, selected: address.object.try(:state)), {include_blank: "SELECT STATE"}, class:"w-100 stateInput #{required}", required: required.present?) %>
<%= address.select(:state, options_for_select(State::STATE_IDS, selected: address.object.try(:state)), {include_blank: "SELECT STATE"}, class:"w-100 #{required}", required: required.present?) %>
</div>
</div>
<div class="d-flex col-sm col-md-6 pr-0">
Expand Down

0 comments on commit ab9b65b

Please sign in to comment.