BUG 8167 SOLVED Mask related bugs
This commit is contained in:
@@ -895,10 +895,6 @@ function G_Text( form, element, name)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (newCursor == -1){
|
|
||||||
|
|
||||||
newCursor = newValue.length;
|
|
||||||
}
|
|
||||||
if (cursor.selectionStart != cursor.selectionEnd){
|
if (cursor.selectionStart != cursor.selectionEnd){
|
||||||
return {result: newValue, cursor: cursor};
|
return {result: newValue, cursor: cursor};
|
||||||
}
|
}
|
||||||
@@ -970,6 +966,7 @@ function G_Text( form, element, name)
|
|||||||
this.applyMask = function(keyCode){
|
this.applyMask = function(keyCode){
|
||||||
if (me.mask != ''){
|
if (me.mask != ''){
|
||||||
dataWOMask = me.removeMask();
|
dataWOMask = me.removeMask();
|
||||||
|
//alert(dataWOMask.result + ', ' + dataWOMask.cursor.selectionStart);
|
||||||
currentValue = dataWOMask.result;
|
currentValue = dataWOMask.result;
|
||||||
currentSel = dataWOMask.cursor;
|
currentSel = dataWOMask.cursor;
|
||||||
cursorStart = currentSel.selectionStart;
|
cursorStart = currentSel.selectionStart;
|
||||||
@@ -1022,20 +1019,22 @@ function G_Text( form, element, name)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (newCursor < 0) newCursor = 0;
|
if (newCursor < 0) newCursor = 0;
|
||||||
if (keyCode != 8 && keyCode != 35 && keyCode != 36 && keyCode != 37 && keyCode != 39){ testData = dataWOMask.result;
|
if (keyCode != 8 && keyCode != 46 && keyCode != 35 && keyCode != 36 && keyCode != 37 && keyCode != 39){ testData = dataWOMask.result;
|
||||||
tamData = testData.length;
|
tamData = testData.length;
|
||||||
cleanMask = me.getCleanMask();
|
cleanMask = me.getCleanMask();
|
||||||
tamMask = cleanMask.length;
|
tamMask = cleanMask.length;
|
||||||
sw = false;
|
sw = false;
|
||||||
if (testData.indexOf(me.comma_separator) == -1){
|
if (testData.indexOf(me.comma_separator) == -1){
|
||||||
//alert('entro');
|
|
||||||
aux = cleanMask.split('_');
|
aux = cleanMask.split('_');
|
||||||
tamMask = aux[0].length;
|
tamMask = aux[0].length;
|
||||||
sw = true;
|
sw = true;
|
||||||
}
|
}
|
||||||
if (tamData >= tamMask && (!swPeriod && testData.indexOf(me.comma_separator) == -1)){
|
if (tamData >= tamMask){
|
||||||
//alert('cancel + ' + String.fromCharCode(keyCode));
|
if (sw && !swPeriod && testData.indexOf(me.comma_separator) == -1){
|
||||||
action = 'none';
|
action = 'none';
|
||||||
|
}
|
||||||
|
if (!sw) action = 'none';
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch(action){
|
switch(action){
|
||||||
@@ -1762,19 +1761,50 @@ function G()
|
|||||||
myOut = _dout + _cout;
|
myOut = _dout + _cout;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//alert(myOut);
|
|
||||||
myOut = invertir(myOut);
|
myOut = invertir(myOut);
|
||||||
|
tmpCursor = 0;
|
||||||
aOut = myOut.split('');
|
aOut = myOut.split('');
|
||||||
for(l=0; l < aOut.length; l++){
|
if (cursor == 0){
|
||||||
switch(aOut[l]){
|
for(l=0; l < aOut.length; l++){
|
||||||
case '0': case '1': case '2': case '3': case '4':
|
switch(aOut[l]){
|
||||||
case '5': case '6': case '7': case '8': case '9':
|
case '0': case '1': case '2': case '3': case '4':
|
||||||
case __DECIMAL_SEP:
|
case '5': case '6': case '7': case '8': case '9':
|
||||||
last = l;
|
case __DECIMAL_SEP:
|
||||||
break;
|
myCursor = l;
|
||||||
|
l = aOut.length;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
myCursor = last + 1;
|
else if(cursor == num.length){
|
||||||
|
for(l=0; l < aOut.length; l++){
|
||||||
|
switch(aOut[l]){
|
||||||
|
case '0': case '1': case '2': case '3': case '4':
|
||||||
|
case '5': case '6': case '7': case '8': case '9':
|
||||||
|
case __DECIMAL_SEP:
|
||||||
|
last = l;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
myCursor = last + 1;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
aNum = num.split('');
|
||||||
|
offset = 0;
|
||||||
|
aNewNum = myOut.split('');
|
||||||
|
for (a = 0; a < cursor; a++){
|
||||||
|
notFinded = false;
|
||||||
|
while (aNum[a] != aNewNum[a + offset] && !notFinded){
|
||||||
|
offset++;
|
||||||
|
if (a + offset > aNewNum.length){
|
||||||
|
offset = -1;
|
||||||
|
notFinded = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
myCursor = cursor + offset;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//myCursor += 1;
|
//myCursor += 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user