1
0
Fork 0

Email page : Disable/enable the "Make Primary" button according to which email is selected

This commit is contained in:
Halfdan Mouritzen 2024-01-18 09:54:34 +01:00
parent a0bbc3adc0
commit 04e4cc0cc6
1 changed files with 14 additions and 4 deletions

View File

@ -17,10 +17,10 @@
{% csrf_token %}
<fieldset class="blockLabels">
<div class="buttonHolder">
<button class="btn small btn-success" type="submit" name="action_primary" style="float:right">+ Add Email</button>
<button class="btn small btn-success" disabled type="submit" name="action_primary">Make Primary</button>
<button class="btn small btn-primary" type="submit" name="action_send">Re-send Verification</button>
<button class="btn small btn-danger" type="submit" name="action_remove">Remove</button>
<button class="small" type="submit" name="action_primary" style="float:right">+ Add Email</button>
<button class="small" disabled type="submit" id="action_primary" name="action_primary">Make Primary</button>
<button class="small" type="submit" name="action_send">Re-send Verification</button>
<button class="small" type="submit" name="action_remove">Remove</button>
</div>
<table class="table" id="user_email_table">
<thead>
@ -45,6 +45,7 @@
{% if emailaddress.primary or user.emailaddress_set.count == 1 %}
checked="checked"
{% endif %}
class="{% if emailaddress.primary %}primary_email{% endif %}"
/>
</td>
<td>
@ -104,6 +105,15 @@
}
});
}
let radio_actions = document.getElementsByName('email');
if (radio_actions.length) {
for (radio of radio_actions) {
radio.addEventListener("change", function (e) {
document.getElementById('action_primary').disabled = e.target.classList.contains('primary_email')
});
}
}
})();
</script>