Text Field y el uso de Mascaras - Forum

Forum Navigation
You need to log in to create posts and topics.

Text Field y el uso de Mascaras

Tengo la siguiente situacion,

en un TextField necesito ingresar el documento de Identidad de mi pais, ejemplo : 3.698.738-0

Uso una mascara para ayudar al usuario a ingresarlo y asi evitar errores tambien, la mascara que uso es : 9.999.999.9

Yo quiero lanzar una accion que se busque el documento ingresado en una base de datos al momento que el usuario termina de ingresar el ultimo digito, sin tenr que apretar ningun boton.

Lo podia hacer si no usaba mascara alguna, simplemente usaba la siguiente rutina:

StrLen "[Cedula]" "[Largo]"
If "[Largo]" "=" "8"

Realizar accion de busqueda

endif

Pero al usar la mascara todo cambio, el resultado de la variable "Largo" siempre me da "11"

Hace caso omiso a si se ingresa algun numero o no, siempre da el largo final

 

Aprovecho a realziar otra consulta, al usar las mascaras, se puede hacer que no sean visibles las mismas? que vayan apareciendo los numeros y los guiones al momento de ingresar el numero

Si es para el RUN (Chile), elimina los 2 últimos caracteres (el - y el dígito verificador) y después remplaza los "." por "" y listo, te deja solo los números.

SearchStr "-" "[Fuente]" "[nGuion]" ""

StrDel "[Fuente]" "[nGuion]" "2" "[Fuente]"

StrReplace "[fuente]" "." "" "[fuente]" ""

PD. Soy de Chile

Solo cambia 8 por 11.

If "[Largo]" "=" "11"

@ gustavo1973

Try this ...

SearchStr " " "[Cedula]" "[PositionOfSpace]" ""
If "[PositionOfSpace]" "=" "0"
   AlertBox "SPaces" "not found"
Else
   AlertBox "Space at" "[PositionOfSpace]"
EndIf

... if any one of the digits has not been filled, [PositionOfSpace] will be the position of the first non-filled character ... otherwise, it will be zero.

Hola, Muchas gracias por sus respuestas, me fueron muy utiles

al final solucione aplicando el siguiente codigo:

StrLen "[Cedula]" "[Largo]"

If "[Largo]" "=" "1"
StrIns "." "[Cedula]" "2" "[Cedula]"
endif
If "[Largo]" "=" "5"
StrIns "." "[Cedula]" "6" "[Cedula]"
endif
If "[Largo]" "=" "9"
StrIns "-" "[Cedula]" "10" "[Cedula]"
endif

Here's a technique I used a while back when I had a similar situation.

Uploaded files:
  • You need to login to have access to uploads.
proforma.guyot has reacted to this post.
proforma.guyot