Skip to content

Commit

Permalink
Mark fields as disabled when hidden, so we don't attempt to save non-…
Browse files Browse the repository at this point in the history
…values
  • Loading branch information
joedolson committed Jan 15, 2024
1 parent bd17d34 commit 6bfa771
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/js/jquery.showfields.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ jQuery(document).ready(function ($) {
});
if (initial_status !== true) {
$('.mt-ticket-form').hide();
$( '.mt-ticket-form input' ).attr( 'disabled', 'disabled' );
$('.mt-ticket-data input').removeAttr('required').removeAttr('aria-required');
} else {
var general_status = $('input[name=mt_general]:checked').val();
Expand Down Expand Up @@ -42,11 +43,12 @@ jQuery(document).ready(function ($) {
$('.mt-ticket-validity').hide();
}
if (checked_status == true) {
$('.mt-ticket-dates input').attr('required', 'required').attr('aria-required', 'true');
$('.mt-available-tickets input').attr('required', 'required').attr('aria-required', 'true');
$( '.mt-ticket-form input' ).removeAttr( 'disabled' );
$('.mt-ticket-data input').attr('required', 'required').attr('aria-required', 'true');
$('.mt-ticket-form').show(300);
} else {
$('.mt-ticket-data input').removeAttr('required').removeAttr('aria-required');
$( '.mt-ticket-form input' ).attr( 'disabled', 'disabled' );
$('.mt-ticket-data input').removeAttr('required').removeAttr('aria-required').attr( 'disabled', 'disabled' );
$('.mt-ticket-form').hide(200);
}
});
Expand Down

0 comments on commit 6bfa771

Please sign in to comment.