feature/username-for-users #70

Merged
bence merged 10 commits from feature/username-for-users into develop 2023-09-25 20:04:50 +02:00
3 changed files with 21 additions and 10 deletions
Showing only changes of commit ea8b46ab91 - Show all commits

View File

@ -183,12 +183,23 @@ var MapGuesser = {
document.getElementById('cover').style.visibility = 'hidden';
},
observeInput: function (input, buttonToToggle) {
if (input.defaultValue !== input.value) {
buttonToToggle.disabled = false;
} else {
buttonToToggle.disabled = true;
observeInput: function (form, observedInputs) {
var anyChanged = false;
for (var i = 0; i < observedInputs.length; i++) {
var input = form.elements[observedInputs[i]];
if (input.type === 'checkbox') {
if (input.defaultChecked !== input.checked) {
anyChanged = true;
}
} else {
if (input.defaultValue !== input.value) {
anyChanged = true;
}
}
}
form.elements['submit_button'].disabled = !anyChanged;
},
observeInputsInForm: function (form, observedInputs) {
@ -199,19 +210,19 @@ var MapGuesser = {
case 'INPUT':
case 'TEXTAREA':
input.oninput = function () {
MapGuesser.observeInput(this, form.elements.submit);
MapGuesser.observeInput(form, observedInputs);
};
break;
case 'SELECT':
input.onchange = function () {
MapGuesser.observeInput(this, form.elements.submit);
MapGuesser.observeInput(form, observedInputs);
};
break;
}
}
form.onreset = function () {
form.elements.submit.disabled = true;
form.elements['submit_button'].disabled = true;
}
}
};

View File

@ -29,7 +29,7 @@
<input type="password" class="text big fullWidth marginTop" name="password_new_confirm" placeholder="New password confirmation" autocomplete="new-password" minlength="6">
<p id="accountFormError" class="formError justify marginTop"></p>
<div class="right marginTop">
<button type="submit" name="submit" disabled>Save</button>
<button type="submit" name="submit_button" disabled>Save</button>
</div>
<hr>
<div class="center">

View File

@ -26,7 +26,7 @@
<?php endif; ?>
<p id="deleteAccountFormError" class="formError justify marginTop"></p>
<div class="right marginTop">
<button class="red marginRight" type="submit" name="submit">Delete account</button><!--
<button class="red marginRight" type="submit" name="submit_button">Delete account</button><!--
--><a class="button gray marginTop" href="/account" title="Back to account">Cancel</a>
</div>
</form>