Disable DN/Rig fields on registration for DN calls

When a user enters a call beginning with DN on the registration page we
now disable the DN-call and rig question fields, so we don't confuse
our SWLs.
This commit is contained in:
Sebastian Lohff 2020-01-20 22:13:06 +01:00 committed by root
parent 2aef677abd
commit 500b79e67a
1 changed files with 29 additions and 1 deletions

View File

@ -21,5 +21,33 @@
</div>
</div>
</div>
{% endblock %}
<script type="text/javascript">
$(document).ready(function() {
function isDNCall(e) {
var call = $("#id_username").val().toUpperCase();
var disableState = false;
console.log("NOOT NOOT" + call);
if(call.startsWith("DN")) {
var disableState = true;
console.log("TIME TO DISABLE SHIT");
}
$("#id_dncall").prop("disabled", disableState);
$("#id_qrv2m").prop("disabled", disableState);
$("#id_qrv70cm").prop("disabled", disableState);
$("#id_extra2m70cm").prop("disabled", disableState);
if(disableState) {
$("#id_dncall").prop("value", "");
$("#id_qrv2m").prop("checked", false);
$("#id_qrv70cm").prop("checked", false);
$("#id_extra2m70cm").prop("checked", false);
}
console.log($("#id_dncall"));
}
$("#id_username").on("input", isDNCall);
$("#id_username").change(isDNCall);
});
</script>
{% endblock %}