mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 04:53:25 +02:00
only check if keys are empty, not all fields
This commit is contained in:
parent
ab8be15ce0
commit
5bd8e46510
1 changed files with 15 additions and 21 deletions
|
@ -908,31 +908,11 @@ function validateInputs() {
|
||||||
}
|
}
|
||||||
|
|
||||||
_.each(tables, function(table) {
|
_.each(tables, function(table) {
|
||||||
var inputs = $(table).find('tr.' + Settings.NEW_ROW_CLASS + ':not([data-category]) input[data-changed="true"]');
|
|
||||||
|
|
||||||
var empty = false;
|
|
||||||
|
|
||||||
_.each(inputs, function(input){
|
|
||||||
var inputVal = $(input).val();
|
|
||||||
|
|
||||||
if (inputVal.length === 0) {
|
|
||||||
empty = true
|
|
||||||
|
|
||||||
markParentRowInvalid(input);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (empty) {
|
|
||||||
showErrorMessage("Error", "Empty field(s)");
|
|
||||||
inputsValid = false;
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// validate keys specificially for spaces and equality to an existing key
|
// validate keys specificially for spaces and equality to an existing key
|
||||||
var newKeys = $(table).find('tr.' + Settings.NEW_ROW_CLASS + ' td.key');
|
var newKeys = $(table).find('tr.' + Settings.NEW_ROW_CLASS + ' td.key');
|
||||||
|
|
||||||
var keyWithSpaces = false;
|
var keyWithSpaces = false;
|
||||||
|
var empty = false;
|
||||||
var duplicateKey = false;
|
var duplicateKey = false;
|
||||||
|
|
||||||
_.each(newKeys, function(keyCell) {
|
_.each(newKeys, function(keyCell) {
|
||||||
|
@ -944,6 +924,14 @@ function validateInputs() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// make sure the key isn't empty
|
||||||
|
if (keyVal.length === 0) {
|
||||||
|
empty = true
|
||||||
|
|
||||||
|
markParentRowInvalid(input);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// make sure we don't have duplicate keys in the table
|
// make sure we don't have duplicate keys in the table
|
||||||
var otherKeys = $(table).find('td.key').not(keyCell);
|
var otherKeys = $(table).find('td.key').not(keyCell);
|
||||||
_.each(otherKeys, function(otherKeyCell) {
|
_.each(otherKeys, function(otherKeyCell) {
|
||||||
|
@ -971,6 +959,12 @@ function validateInputs() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty) {
|
||||||
|
showErrorMessage("Error", "Empty field(s)");
|
||||||
|
inputsValid = false;
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (duplicateKey) {
|
if (duplicateKey) {
|
||||||
showErrorMessage("Error", "Two keys cannot be identical");
|
showErrorMessage("Error", "Two keys cannot be identical");
|
||||||
inputsValid = false;
|
inputsValid = false;
|
||||||
|
|
Loading…
Reference in a new issue