checkbox can't be unselected
This commit is contained in:
parent
d308d2f26d
commit
fad4e7a174
3 changed files with 13 additions and 18 deletions
|
|
@ -1,5 +1,5 @@
|
|||
* {
|
||||
font-family: 'Courier New', Courier, monospace;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ const btcMethodCheckboxesWarning = document.getElementById(
|
|||
|
||||
const btcMethodCheckboxes = [onchainCheckbox, lightningCheckbox];
|
||||
|
||||
const publishOfferButton = document.getElementById('button-submit-offer');
|
||||
|
||||
function toggleCreateOfferControls() {
|
||||
createOfferControls.style.display =
|
||||
createOfferControls.style.display === 'block' ? 'none' : 'block';
|
||||
|
|
@ -92,19 +94,10 @@ function updateBtcInput() {
|
|||
btcAmountInput.value = formattedSatsAmount;
|
||||
}
|
||||
|
||||
function validateBitcoinMethodCheckboxes() {
|
||||
let noneChecked = true;
|
||||
|
||||
for (const aCheckbox of btcMethodCheckboxes) {
|
||||
if (aCheckbox.checked) {
|
||||
noneChecked = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (noneChecked) {
|
||||
btcMethodCheckboxesWarning.style.display = 'block';
|
||||
} else {
|
||||
btcMethodCheckboxesWarning.style.display = 'none';
|
||||
function validateBitcoinMethodCheckboxes(clickedCheckbox) {
|
||||
let checkedCount = btcMethodCheckboxes.filter((cb) => cb.checked).length;
|
||||
if (checkedCount === 0) {
|
||||
clickedCheckbox.checked = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -141,7 +134,9 @@ eurAmountInput.addEventListener('input', () => {
|
|||
});
|
||||
|
||||
for (const btcMethodCheckbox of btcMethodCheckboxes) {
|
||||
btcMethodCheckbox.addEventListener('input', () => {
|
||||
validateBitcoinMethodCheckboxes();
|
||||
btcMethodCheckbox.addEventListener('click', () => {
|
||||
validateBitcoinMethodCheckboxes(btcMethodCheckbox);
|
||||
});
|
||||
}
|
||||
|
||||
updateBtcInput();
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@
|
|||
id="input-eur-amount"
|
||||
type="text"
|
||||
class="money-input input-money-amount"
|
||||
placeholder="100"
|
||||
value="100"
|
||||
required
|
||||
/>
|
||||
<div id="eur-symbol" class="curr-symbol">
|
||||
|
|
@ -162,7 +162,7 @@
|
|||
</div>
|
||||
|
||||
<%- include("partials/appCommonScripts") %>
|
||||
<script src="/javascript/offers.js"></script>
|
||||
<script src="/javascript/utils.js"></script>
|
||||
<script src="/javascript/offers.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue