Revision f411025c
Von Thomas Kasulke vor mehr als 17 Jahren hinzugefügt
js/common.js | ||
---|---|---|
57 | 57 |
thnumbers[thnumbers.length-1] = thnumbers[thnumbers.length-1].substring((thnumbers[thnumbers.length-1].lastIndexOf(",") !== -1 ? thnumbers[thnumbers.length-1].lastIndexOf(",") : thnumbers[thnumbers.length-1].length), 0); |
58 | 58 |
} |
59 | 59 |
|
60 |
for(var i = 1; i < thnumbers.length; i++) { |
|
61 |
if(thnumbers[i].length !== 3) { |
|
62 |
return show_alert_and_focus(input_name, wrongNumberFormat+thnumbers); |
|
60 |
for(var i = 0; i < thnumbers.length; i++) { |
|
61 |
if(i == 0 && thnumbers[i].length > 3) { |
|
62 |
return show_alert_and_focus(input_name, wrongNumberFormat); |
|
63 |
} |
|
64 |
if(i > 0 && thnumbers[i].length != 3) { |
|
65 |
return show_alert_and_focus(input_name, wrongNumberFormat); |
|
63 | 66 |
} |
64 | 67 |
} |
65 | 68 |
} |
... | ... | |
71 | 74 |
} |
72 | 75 |
if(decnumbers.length == 2) { |
73 | 76 |
if(decnumbers[1].length > 2) { |
74 |
return show_alert_and_focus(input_name, wrongNumberFormat + decnumbers);
|
|
77 |
return show_alert_and_focus(input_name, wrongNumberFormat); |
|
75 | 78 |
} |
76 | 79 |
} |
77 | 80 |
else { |
78 |
if(decnumbers.length > 1 || decnumbers.length == 0) {
|
|
81 |
if(decnumbers.length > 2) {
|
|
79 | 82 |
return show_alert_and_focus(input_name, wrongNumberFormat); |
80 | 83 |
} |
81 | 84 |
if(!thpoint) { |
... | ... | |
133 | 136 |
|
134 | 137 |
function show_alert_and_focus(input_name, errorMessage) { |
135 | 138 |
input_name.select(); |
136 |
alert(errorMessage + "\n\r\n\r--> " + input_name.value); // + "\ndecpoint: " + decpoint + "\nthpoint: " + thpoint
|
|
139 |
alert(errorMessage + "\n\r\n\r--> " + input_name.value); |
|
137 | 140 |
input_name.focus(); |
138 | 141 |
return false; |
139 | 142 |
} |
Auch abrufbar als: Unified diff
Stricktere Überwachung der Nummernformate eingeführt. Auch 1000,00 wird bei Formaten wie 1,000.00 und 1.000,00 jetzt als falsch erkannt.