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;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,8 @@ const btcMethodCheckboxesWarning = document.getElementById(
|
||||||
|
|
||||||
const btcMethodCheckboxes = [onchainCheckbox, lightningCheckbox];
|
const btcMethodCheckboxes = [onchainCheckbox, lightningCheckbox];
|
||||||
|
|
||||||
|
const publishOfferButton = document.getElementById('button-submit-offer');
|
||||||
|
|
||||||
function toggleCreateOfferControls() {
|
function toggleCreateOfferControls() {
|
||||||
createOfferControls.style.display =
|
createOfferControls.style.display =
|
||||||
createOfferControls.style.display === 'block' ? 'none' : 'block';
|
createOfferControls.style.display === 'block' ? 'none' : 'block';
|
||||||
|
|
@ -92,19 +94,10 @@ function updateBtcInput() {
|
||||||
btcAmountInput.value = formattedSatsAmount;
|
btcAmountInput.value = formattedSatsAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateBitcoinMethodCheckboxes() {
|
function validateBitcoinMethodCheckboxes(clickedCheckbox) {
|
||||||
let noneChecked = true;
|
let checkedCount = btcMethodCheckboxes.filter((cb) => cb.checked).length;
|
||||||
|
if (checkedCount === 0) {
|
||||||
for (const aCheckbox of btcMethodCheckboxes) {
|
clickedCheckbox.checked = true;
|
||||||
if (aCheckbox.checked) {
|
|
||||||
noneChecked = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (noneChecked) {
|
|
||||||
btcMethodCheckboxesWarning.style.display = 'block';
|
|
||||||
} else {
|
|
||||||
btcMethodCheckboxesWarning.style.display = 'none';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -141,7 +134,9 @@ eurAmountInput.addEventListener('input', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
for (const btcMethodCheckbox of btcMethodCheckboxes) {
|
for (const btcMethodCheckbox of btcMethodCheckboxes) {
|
||||||
btcMethodCheckbox.addEventListener('input', () => {
|
btcMethodCheckbox.addEventListener('click', () => {
|
||||||
validateBitcoinMethodCheckboxes();
|
validateBitcoinMethodCheckboxes(btcMethodCheckbox);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateBtcInput();
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@
|
||||||
id="input-eur-amount"
|
id="input-eur-amount"
|
||||||
type="text"
|
type="text"
|
||||||
class="money-input input-money-amount"
|
class="money-input input-money-amount"
|
||||||
placeholder="100"
|
value="100"
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
<div id="eur-symbol" class="curr-symbol">
|
<div id="eur-symbol" class="curr-symbol">
|
||||||
|
|
@ -162,7 +162,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%- include("partials/appCommonScripts") %>
|
<%- include("partials/appCommonScripts") %>
|
||||||
<script src="/javascript/offers.js"></script>
|
|
||||||
<script src="/javascript/utils.js"></script>
|
<script src="/javascript/utils.js"></script>
|
||||||
|
<script src="/javascript/offers.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue