cmsmanage/paperwork/static/paperwork/certification-form-clear-autocomplete.js

11 lines
484 B
JavaScript

window.addEventListener('load', function() {
// Bind on certification_definition field change
django.jQuery(':input[name$=certification_definition]').on('change', function() {
// Get the field prefix, ie. if this comes from a formset form
var prefix = django.jQuery(this).getFormPrefix();
// Clear the autocomplete with the same prefix
django.jQuery(':input[name=' + prefix + 'certification_version]').val(null).trigger('change');
});
});