feature/user-data #11
@ -158,12 +158,17 @@ var RVR = {
|
|||||||
document.getElementById('cover').style.visibility = 'hidden';
|
document.getElementById('cover').style.visibility = 'hidden';
|
||||||
},
|
},
|
||||||
|
|
||||||
observeInput: function (input, buttonToToggle) {
|
observeInput: function (form, observedInputs) {
|
||||||
if (input.defaultValue !== input.value) {
|
var anyChanged = false;
|
||||||
buttonToToggle.disabled = false;
|
|
||||||
} else {
|
for (var i = 0; i < observedInputs.length; i++) {
|
||||||
buttonToToggle.disabled = true;
|
var input = form.elements[observedInputs[i]];
|
||||||
|
if (input.defaultValue !== input.value) {
|
||||||
|
anyChanged = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
form.elements.submit.disabled = !anyChanged;
|
||||||
},
|
},
|
||||||
|
|
||||||
observeInputsInForm: function (form, observedInputs) {
|
observeInputsInForm: function (form, observedInputs) {
|
||||||
@ -174,12 +179,12 @@ var RVR = {
|
|||||||
case 'INPUT':
|
case 'INPUT':
|
||||||
case 'TEXTAREA':
|
case 'TEXTAREA':
|
||||||
input.oninput = function () {
|
input.oninput = function () {
|
||||||
RVR.observeInput(this, form.elements.submit);
|
RVR.observeInput(form, observedInputs);
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case 'SELECT':
|
case 'SELECT':
|
||||||
input.onchange = function () {
|
input.onchange = function () {
|
||||||
RVR.observeInput(this, form.elements.submit);
|
RVR.observeInput(form, observedInputs);
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user