From a4caab981b67a40e157d69e8feadcb7ce8b6d7ea Mon Sep 17 00:00:00 2001 From: Carlos Pacha Date: Fri, 28 Jan 2011 22:32:08 +0000 Subject: [PATCH] this bug was 5906 solved, now it is setting % symbol --- gulliver/js/form/core/form.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/gulliver/js/form/core/form.js b/gulliver/js/form/core/form.js index f44cafc16..236a715a7 100644 --- a/gulliver/js/form/core/form.js +++ b/gulliver/js/form/core/form.js @@ -435,16 +435,21 @@ function replaceAll( text, busca, reemplaza ){ this.putFormatNumber =function (evt) { if((typeof(evt)==="undefined" || evt===0) && me.mask!='' ){ var numberSet=me.element.value.split('.'); - if(numberSet.length >=2)return; +// if(numberSet.length >=2)return; maskD = me.mask.split(';'); maskL = (maskD.length >1)?maskD[1]:maskD[0]; maskWithoutC =replaceAll(maskL,",",""); //maskWithoutC =replaceAll(maskWithoutC,".",""); //maskWithoutC =replaceAll(maskWithoutC,"#",""); - maskWithoutC =replaceAll(maskWithoutC,"%",""); +// maskWithoutC =replaceAll(maskWithoutC,"%",""); maskWithoutC =replaceAll(maskWithoutC," ",""); maskWithoutPto=replaceAll(maskWithoutC,".",""); + if(numberSet.length >=2){ + if(maskWithoutPto.substr( (maskWithoutPto.length -1) ,maskWithoutPto.length) =="%") + me.element.value = me.element.value+' '+maskWithoutPto.substr( (maskWithoutPto.length -1) ,maskWithoutPto.length); + return; + } maskElemnts = maskWithoutC.split('.'); maskpartInt = maskElemnts[0].split(''); @@ -504,7 +509,13 @@ function replaceAll( text, busca, reemplaza ){ onlynumber =parseInt(onlynumber / 10); cc++; } - me.element.value = newnamber; + if(maskWithoutPto.substr( (maskWithoutPto.length -1) ,maskWithoutPto.length) =="%") + me.element.value = newnamber+' '+maskWithoutPto.substr( (maskWithoutPto.length -1) ,maskWithoutPto.length); + else + me.element.value = newnamber; + } else { + if(maskWithoutPto.substr( (maskWithoutPto.length -1) ,maskWithoutPto.length) =="%") + me.element.value = onlynumber +' '+maskWithoutPto.substr( (maskWithoutPto.length -1) ,maskWithoutPto.length); } } }