You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

42 lines
1.2 KiB

window.addEventListener("load", function() {
(function($) {
$(function() {
// selfbuy section
var selectField_selfbuy = $('#id_selfbuy'),
verified_selfbuy_div = $('#id_selfbuy_give_data').parent().parent(),
verified_selfbuy = $('#id_selfbuy_give_data'),
data_selfbuy_div = $('#id_selfbuy_data').parent().parent(),
data_selfbuy = $('#id_selfbuy_data');
// make checked to get through the required
function toggleVerified_selfbuy(value) {
if (value === "FALSE") {
verified_selfbuy_div.show();
data_selfbuy_div.show();
data_selfbuy.val("");
verified_selfbuy.prop("checked", false);
} else {
verified_selfbuy_div.hide();
data_selfbuy_div.hide();
data_selfbuy.val("NONE");
verified_selfbuy.prop("checked", true);
}
}
// show/hide on load based on existing value of selectField
toggleVerified_selfbuy(selectField_selfbuy.val());
// show/hide on change
selectField_selfbuy.change(function() {
toggleVerified_selfbuy($(this).val());
});
});
})(django.jQuery);
});